无法在Mac中导入cv2

时间:2017-05-19 14:29:08

标签: python opencv pip homebrew cv2

我无法在MacOS Sierra上安装opencv(或)cv2

我已经尝试了pip install opencv并且说:

Could not find a version that satisfies the requirement opencv

当我使用brew install opencv时,它给了我一条消息:

opencv2 is already installed but not linked so run this command:

    export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

但即使它显示相同的错误且无法导入cv2。有什么办法可以解决这个问题吗?或任何IDE将帮助我导入和使用openCV?

2 个答案:

答案 0 :(得分:1)

试试这样:

pip install opencv-python

之后您可以将其导入为: import opencv

答案 1 :(得分:0)

添加使用OpenCV所在的homebrew / science:

brew tap homebrew/science

安装OpenCV

brew install opencv

就是这样。您可以在以下位置打开CV: cd /usr/local/Cellar/opencv/2.4.9 /