I have installed OpenCV on the Occidentalis operating system (a variant of Raspbian) on a Raspberry Pi, using jayrambhia's script found here. It installed version 2.4.5.
When I try import cv2
in a Python program, I get the following message:
pi@raspberrypi~$ python cam.py
Traceback (most recent call last)
File "cam.py", line 1, in <module>
import cv2
ImportError: No module named cv2
The file cv2.so
is stored in /usr/local/lib/python2.7/site-packages/...
There are also folders in /usr/local/lib
called python3.2 and python2.6, which could be a problem but I'm not sure.
Is this a path error perhaps? Any help is appreciated, I am new to Linux.
First do run these commands inside Terminal/CMD:
conda update anaconda-navigator
conda update navigator-updater
Then the issue for the instruction below will be resolved
For windows if you have anaconda installed, you can simply do
pip install opencv-python
or
conda install -c https://conda.binstar.org/menpo opencv
if you are on linux you can do :
pip install opencv-python
or
conda install opencv
For python3.5+ check these links : Link3 , Link4
Update:
if you use anaconda, you may simply use this as well (and hence don't need to add menpo channel):
conda install -c conda-forge opencv