为什么我无法在 Mac 12.0.1 (Monterey) 上使用 pip 安装 OpenCV? [复制]

2024-05-14

当我尝试使用 python pip 安装 OpenCV 时,它显示了以下内容:

Remainder of file ignored
Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (20.3.4)
Collecting pip
  Using cached pip-21.3.1-py3-********* (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.4
    Uninstalling pip-20.3.4:
      Successfully uninstalled pip-20.3.4
Successfully installed pip-21.3.1

*Mine*-MacBook-Air ~ % pip install cv2
Error processing line 1 of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/********:
Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen **********bootstrap>", line 562, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored

Error processing line 1 of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/*******************:

Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<********.bootsrap>", line 562, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2

我不知道为什么即使我尝试重新安装 python,也没有任何反应!

我在 Macbook Air 上“上面给出了版本”,即使使用 python 10.1(最新版本)也没有任何反应!

我的pip版本也是最新的(可以在上面的命令中找到)。

此外,某些软件包不会出现此问题,仅会出现在 open cv (cv2) 等少数软件包中。另外,我用来安装它的命令是“PIP install cv2”。并且请不要建议我升级我的 python 版本,因为我已经尝试过了并且它显示了同样的事情!


Try pip install opencv-python代替pip install cv2

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么我无法在 Mac 12.0.1 (Monterey) 上使用 pip 安装 OpenCV? [复制] 的相关文章

随机推荐