Cannot import cv2 in python in OSX
For me installation using conda didn't worked. While installing it using pip worked:
pip install opencv-python
os: macos Catalina
You can install by
pip install opencv-python
I do not know what pip install cv2
actually installs... but is surely not OpenCV. pip install cv2
actually installs this, which are some blog distribution utilities, not sure what it is, but it is not OpenCV.
To properly install OpenCV, check any of the links @udit043 added in the comment, or refer to any of the tutorials bellow:
Find here a tutorial on how to install OpenCV on OS X: http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
You need to actually compile OpenCV from source and activate python bindings, which takes a while.
Another option is to use brew
to get OpenCV, but doesn't neccesarilly get you the last version nor a fully optimized one:
https://web.archive.org/web/20171218032016/http://www.mobileway.net/2015/02/14/install-opencv-for-python-on-mac-os-x/
I used
conda install opencv
and it installed fine for me.
You might want to try this if you are using Anaconda.