1. 程式人生 > >Mac安裝Python版OpenCV

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

不報錯,安裝成功。