Raspberry Pi‎ > ‎

Install OpenCV 3.30 for Python 3.6 on MacOS

posted Sep 2, 2016, 4:27 AM by Chris G   [ updated Dec 30, 2017, 7:09 AM ]
How to Install OpenCV 3.30 MacOS High Sierra:

  The best way is simply to use homebrew: 

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
#brew install git cmake
brew install pkg-config jpeg libpng libtiff openexr eigen tbb
brew install opencv3 --with-contrib --with-python3  

Homebrew will unfortunately not install the package in the proper location, so we need to rename the package and link it to the proper place for Python to find it. Adjust accordingly for your OS and Python version. 

mv /usr/local/opt/opencv/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/opt/opencv/lib/python3.6/site-packages/cv2.so
#echo /usr/local/opt/opencv/lib/python3.6/site-packages/ >> /usr/local/lib/python3.6/site-packages/opencv3.pth
echo /usr/local/opt/opencv/lib/python3.6/site-packages/ >> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/opencv3.pth
#python3 -c "import sys; print(next(p for p in sys.path if 'site-packages' in p))"

Finally...verify the installation:


Type "help", "copyright", "credits" or "license" for more inform
>>> cv2.__version__