关于安装 python opencv-python 库报错,但安装其他库(比如:flask)却不会报错

a1@Macintosh ~ % pip3 install opencv-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting opencv-python
  Downloading https://mirrors.aliyun.com/pypi/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz (88.0 MB)
     || 88.0 MB 5.1 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Library/Python/2.7/site-packages/pip-20.2.2-py2.7.egg/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/tmpI11i93
       cwd: /private/var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/pip-install-Fu0fOp/opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/pip-20.2.2-py2.7.egg/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/Library/Python/2.7/site-packages/pip-20.2.2-py2.7.egg/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Library/Python/2.7/site-packages/pip-20.2.2-py2.7.egg/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/pip-build-env-sPQZ2X/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/private/var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/pip-build-env-sPQZ2X/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/pip-build-env-sPQZ2X/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/private/var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/pip-build-env-sPQZ2X/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in <module>
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable
  ----------------------------------------
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Library/Python/2.7/site-packages/pip-20.2.2-py2.7.egg/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/9f/0zttwvx11l94ymkzbb8zqpvw0000gn/T/tmpI11i93 Check the logs for full command output.

为什么我安装这个 opencv-python 的库会报错,但我安装其他库(比如:flask)就不会?

阅读 5.3k
1 个回答

pip3 用于安装 python3 类库,请改用 python3 或试一下 pip2 吧。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题