我试图在我的mac上安装OpenCV-python,我使用了以下内容:
$pip安装opencv-python
这给了我以下错误:
$pip install opencv-python
Collecting opencv-python
Using cached opencv_python-3.4.0.12-cp27-cp27m macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.然后我确实尝试了pip install --upgrade matplotlib,它没有改变任何东西。它只是告诉我:
matplotlib 2.2.2 requires backports.functools-lru-cache, which is not installed.
matplotlib 2.2.2 has requirement numpy>=1.7.1, but you'll have numpy 1.8.0rc1 which is incompatible.因为我发现了许多在互联网上安装openCV-python的方法,比如:https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/。
我安装在我的另一个mac上,但是我的代码中经常出现导入cv2问题。如果有人有一个很好的解决方案或推荐来安装openCV-python,我会非常高兴的。
谢谢
发布于 2018-04-05 00:12:40
总之,macOS附带了预安装的Python,您不应该因为某些系统实用程序依赖于它们而扰乱安装的包。
https://docs.python.org/3.7/using/mac.html
Apple提供的Python版本分别安装在/System/Library/Frameworks/Python.framework和/usr/bin/python中。你永远不应该修改或删除这些,因为它们是苹果控制的,并由苹果或第三方软件使用。请记住,如果您选择从python.org安装一个较新的Python版本,那么您的计算机上将有两个不同但功能不同的Python安装,因此您的路径和用法与您想要做的操作是一致的,这一点非常重要。
您可以读到这个答案:https://stackoverflow.com/a/41972262/4796844,它将帮助您了解基本知识。
简而言之,要解决你的问题:
$ python3 -m venv ./project-name
$ . ./project-name/bin/activate
$ pip install opencv-python要离开虚拟环境,只需:
$ deactivatehttps://stackoverflow.com/questions/49662022
复制相似问题