安装opencv 3.x
brew install opencv==3.x
brew install opencv@2
opencv@2这个是装到这里的:
/usr/local/Cellar/opencv@2/2.4.13.6_2/lib/python2.7/site-packages
如果想在anaconda上用,需要做一个软链接
anaconda的site-packages的路径:/User/zhongzunfa/anaconda2/lib/python2.7/site-packages
软链接步骤:
cd /Users/zhongzunfa/anaconda2/lib/python2.7/site-packages
软链接两个文件:
ln -s /usr/local/Cellar/opencv@2/2.4.13.6_2/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv@2/2.4.13.6_2/lib/python2.7/site-packages/cv2.so cv2.so
如果anaconda有多个版本的opencv的话,把原来那个重命名了,再软链接另外一个,下次用的时候再改回来