Mac Installation Guide:
Open Terminal
Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install OpenCV
brew tap homebrew/science
brew install opencv
Run python and test if it works!
python
>>> import cv2
Debugging:
'numpy.core.multiarray failed to import'
- In terminal type:
python >>> import numpy >>> numpy.__path__ # if this prints out something along the lines of # '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras'
Then put this at the top of their file:
import sys
for p in sys.path:
if p.startswith('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras'):
sys.path.remove(p)
- "No module named 'cv2'"
- In terminal type:
cd ~
open .bash_profile
# at the bottom
PATH="/usr/local/lib/python2.7/site-packages:${PATH}"
export PATH
Save that file using cmd + S. Then run:
source ~/.bash_profile
Then try running python and importing cv2 again!