mac osx 下安裝opencv

1.安裝homebrewpython

網上方法不少,自行搜索git

2.安裝cmakegithub

sudo brew install cmake

 3.下載opencv源代碼bash

wget https://github.com/Itseez/opencv/archive/2.4.13.zip

 4.解壓安裝python2.7

unzip 2.4.13.zip
cd opencv-2.4.13/
mkdir build
cd build/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
make
sudo make install

 5.將cv2.so文件連接到python的site-packages目錄測試

sudo ln -s /usr/local/lib/python2.7/site-packages/cv2.so /Library/Python/2.7/site-packages/

 6.python裏測試ui

>>> import cv2
>>> print cv2.__version__
2.4.13

 另:homebrew 能夠直接安裝opencv,沒有測試,這裏僅供參考:blog

brew update
brew tap homebrew/homebrew-science
brew install opencv
相關文章
相關標籤/搜索