Skip to content

Instantly share code, notes, and snippets.

@NSStudent
Forked from ldong/install_opencv_on_mac.md
Created February 21, 2017 22:59
Show Gist options
  • Save NSStudent/c0da018c3830165f3b76a1651fbf7de3 to your computer and use it in GitHub Desktop.
Save NSStudent/c0da018c3830165f3b76a1651fbf7de3 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