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

发布于 2022-09-12 04:30:31 字数 3590 浏览 24 评论 0

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)就不会?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剪不断理还乱 2022-09-19 04:30:31

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文