python - 在 macOS Catalina 上使用 python 3.9 在虚拟环境中安装 opencv-python 时出错
问题描述
我正在尝试deeplearning
使用 macOS Catalina 在我的 MacBook Pro 上设置一个名为 , 的虚拟环境,用于深度学习项目 :-)。
在deeplearning
我所做的虚拟环境中,pip install opencv-python
但这会引发错误,我不明白......我该如何解决?我忽略了什么吗?
查看整个错误输出的最后一点,它似乎正在尝试将不同numpy
版本与特定python
版本匹配。Python 3.9
不在其中。这是问题吗?我应该恢复到版本Python 3.8
吗?
我安装python@3.9
并numpy
使用brew
.
谢谢
桑德
pip install opencv-python
Collecting opencv-python
Using cached opencv-python-4.4.0.44.tar.gz (88.9 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /Users/swvanderlaan/.virtualenvs/deeplearning/bin/python /Users/swvanderlaan/.virtualenvs/deeplearning/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-build-env-mudxxq4k/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"''
cwd: None
Complete output (4098 lines):
Ignoring numpy: markers 'python_version == "3.5"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7"' don't match your environment
[由于字数限制,我无法发布所有内容。]
ERROR: Command errored out with exit status 1: /Users/swvanderlaan/.virtualenvs/deeplearning/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-install-we6wxt_t/numpy/setup.py'"'"'; __file__='"'"'/private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-install-we6wxt_t/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-record-wdchzme9/install-record.txt --single-version-externally-managed --prefix /private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-build-env-mudxxq4k/overlay --compile --install-headers /private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-build-env-mudxxq4k/overlay/include/site/python3.9/numpy Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/swvanderlaan/.virtualenvs/deeplearning/bin/python /Users/swvanderlaan/.virtualenvs/deeplearning/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/pip-build-env-mudxxq4k/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' Check the logs for full command output.
并更新。这延伸到安装:scipy
和scikit-learn
-scikit-image
它们都依赖于numpy
. 其中也安装了pip3 install numpy
.
解决方案
问题是这Python 3.9
只是一些旧的弱点,而且看起来没有可用于OpenCV
. pip
尝试从源代码编译它也是如此,这显然失败了,因为它有很多依赖项。
我建议您现在安装并在几周/几个月内Python 3.8
升级到所有常用软件包都可以在.Python 3.9
pip
推荐阅读
- javascript - 浏览器不会呈现动态分配给 dataTable 单元格的 Javascript 变量中的 HTML 锚点
- python - Python,我想在导入csv文件后转换特定的列类型
- ios - 无法在 react-native 中清除 TextInput 的值
- html - 自动调整大小的 textarea 元素底部出现额外的空白
- javascript - 有没有办法让所有的 Facebook 广告?
- javascript - 怎么修?由于值错误,Discord.js Bot 一直离线
- java - (处理)创建第二个窗口使主窗口非常小
- java - view.findViewById() 在一个函数中返回 null 但在另一个函数中工作正常
- r - R 并行中止所有 mclapply 操作
- javascript - 数据表行:手动更新字段