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)就不會?
uj5u.com熱心網友回復:
你的pip3 為什么運行在2.7的環境中?opencv已經不支持python2 了uj5u.com熱心網友回復:
我也不知道啊~你知道怎么改嗎?uj5u.com熱心網友回復:
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.大意是說python2.7不在維護了,叫你下載python3,你把現在的python卸了重裝
uj5u.com熱心網友回復:
我安裝了 python 3.7 了,而且按道理 pip3 不是應該是運行 python3 的嗎?uj5u.com熱心網友回復:
需要配置pip默認使用的python版本https://jingyan.baidu.com/article/a17d5285daf7398099c8f251.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/13297.html
