I have a Ubuntu 14.04 system on which I want to install OpenCV and use it with Python 2.x.
I installed OpenCV using the following instructions: https://help.ubuntu.com/community/OpenCV
The installation seemed to work correctly, no errors, the script ended up exiting
OpenCV 2.4.9 ready to be used
When I try to run a sample Python script, I get the following:
$ python opencv.py Traceback (most recent call last): File "opencv.py", line 1, in <module> from cv2.cv import * ImportError: No module named cv2.cv
I suspect I know why, I just don't know how to fix it. OpenCV is installed in the current directory that I was in when I ran the installation script, this is a subdirectory of my home folder.
Others that get this import error after installation seem to have a problem with the path, and they are fortunate enough to add this to their code:
import sys sys.path.append('/usr/local/lib/python2.7/site-packages')
or update their PYTHONPATH using the same directory. I tried to add this code, it does not matter. I do not see any files in the "site-packages" directory. Should I do the installation in this directory? I assume that the installation instructions would have to spell it out. I suspect my problem is that Python cannot find the OpenCV installation, but I'm not sure how to do this.
Please help me get a convenient installation of OpenCV as simple as possible.
python ubuntu opencv importerror
robm Aug 09 '14 at 4:01 2014-08-09 04:01
source share