Skip to content

Instantly share code, notes, and snippets.

@mikewlange
Forked from ldong/install_opencv_on_mac.md
Created June 2, 2017 01:10
Show Gist options
  • Save mikewlange/fc3d295ffa1bdeee249fe8d56567e41b to your computer and use it in GitHub Desktop.
Save mikewlange/fc3d295ffa1bdeee249fe8d56567e41b to your computer and use it in GitHub Desktop.
install opencv on mac
  1. Create a virtualenv, mkvirtualenv lookup

  2. install opencv on mac via homebrew

brew tap homebrew/science
brew install opencv
cd ~/.virtualenvs/lookup/lib/python2.7/site-packages
ln -s /usr/local/Cellar/opencv/{VERSION_NUMBER}/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/{VERSION_NUMBER}/lib/python2.7/site-packages/cv2.so cv2.so

i.e.

cd ~/.virtualenvs/lookup/lib/python2.7/site-packages
ln -s /usr/local/Cellar/opencv/2.4.12_2/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.12_2/lib/python2.7/site-packages/cv2.so cv2.so
  1. Test see it works or not.
workon lookup
python
import cv2

Reference

https://gist.github.com/stilist/cd7fdfabbf9ec5ed89b7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment