Reputation: 1752
I downloaded the OpenCV source tarball from http://sourceforge.net/projects/opencvlibrary, and I performed the following steps:
Now, when I try to do import cv2
I get an ImportError:
ImportError: No module named cv2
NOTE: This is for Mac OS X
Upvotes: 0
Views: 485
Reputation: 1752
As of this writing, following these instructions successfully installed Python opencv on Mac OS X for me: http://www.pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/
There is an older version of that tutorial, but it had issues with macOS Sierra, so make sure you are following the most recent version. Also, be careful not to just copy and paste everything, especially commands with arguments or flags with situation-specific values, such as paths. For example, if you are not using virtualenv, make sure to replace the virtualenv-based paths with your local Python installation paths. This is particularly important when filling out the cmake
flag fields when you get to that step.
Also, as Quang Hoang mentioned, doing brew install opencv3 --with-python
could be a faster alternative.
Upvotes: 0
Reputation: 965
I recommend to download the whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/
Open the cmd in directory in which whl file is installed and type:
pip install file-name.whl
It worked for me, I hope it will work for you too.
Upvotes: 0