简单粗暴
使用homebrew安装
brew install opencv //cv2 我安装的
brew install opencv3 //cv3
安装包位置
/Library/Caches/Homebrew
解压的文件位置
/usr/local/Cellar/opencv
找到cv2.so拷贝到python的site-packages里面
cv2.so按照上面的安装默认位置在/usr/local/Cellar/opencv/3.3.0_3/lib/python2.7/site-packages/cv2.so
pythonde site-packages位置
执行下面的python命令查看
import site
print(site.getsitepackages())
我的位置是/Library/Python/2.7/site-packages
sudo cp /usr/local/Cellar/opencv/3.3.0_3/lib/python2.7/site-packages/cv2.so /Library/Python/2.7/site-packages
检查
import cv2
cv2.__version__