Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Last active August 29, 2015 14:10
Show Gist options
  • Save copyleftdev/a66d9b132a1cec5a28ea to your computer and use it in GitHub Desktop.
Save copyleftdev/a66d9b132a1cec5a28ea to your computer and use it in GitHub Desktop.
Install OpenCV on OSX with python bindings

Installing OpenCV with Python Bindings

OSX Install instructions

Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Python 2.7.x

Add this line to ~/.profile

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Now install Python

$ brew install python

Install Virtualenv & VirtualenvWrapper

Install virtualenv: sudo pip install virtualenv.

Install virtualenvwrapper sudo pip install virtualenvwrapper.

Navigate to you're home directory cd $HOME.

Make a folder to house virtual enviroments mkdir .virtualenvs.

add source /usr/local/bin/virtualenvwrapper.sh to you're .bash_login file.

Make a Virtual Enviroment before installing OpenCV mkvirvirtualenv <name>

Install OpenCV

Install opencv brew install homebrew/science/opencv

Create Symlinks for Python Bindings

ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py

ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so

Testing Python Bindings Open a python shell & type import cv

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