Mac安装Python版OpenCV

文章作者:Tyan
博客:noahsnail.com  |  CSDN  | 

1. brew安装opencv

brew install homebrew/science/opencv

brew install homebrew/science/opencv3

2. 把opencv添加到python中

执行下面的命令,或直接将/usr/local/Cellar/opencv3/3.1.0_4/lib/python2.7/site-packages/下的cv2.so拷贝到/Users/ltc/anaconda/lib/python2.7/site-packages/目录中。

echo /usr/local/Cellar/opencv3/3.1.0_4/lib/python2.7/site-packages/ >> /Users/ltc/anaconda/lib/python2.7/site-packages/opencv3.pth

3. 测试

$ python
$ import cv2

不报错,安装成功。

你可能感兴趣的:(Mac安装Python版OpenCV)