我们可以安装opencvforpythonformacosx和自制程序。
首先,安装自制:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
您可以查看有关如何安装自制程序的详细信息。http://brew.sh
如果不安装Python,请安装Python(brew将安装python2.7):
brew install python
也许你想安装Python3:brew install python3
然后为Python3安装opencv3:
brew install opencv3 --with-python3
如果要安装opencv3 for Python(Python2.7):brew install opencv3 --with-python
或者为Python3安装opencv2:brew install opencv --with-python3
或者如果你想为Python3安装opencv2:brew install opencv --with-python3
最后,也许您会将opencv的站点包链接到Python的站点包。
注意:在下面的命令中,/usr/local/opt/opencv3/lib/python3.5/site-packages是opencv3站点包的目录,/usr/local/lib/python3.5/site-packages/是Python3.5站点包的目录。
也许您应该将这两个目录更改为自己的OPENCV和PYTHONsite-packages目录。
echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth