Reputation: 4114
Following the steps given here, i have completed the installation process, however Python (IDLE) is giving me an ImportError. For which the guide suggests :
Python may return to you an error like "
No module named cv
" The trouble is that the python module is installed in/usr/local/lib/python2.6/site-packages
. But, on Debian and on Ubuntu, Python only looks in/usr/local/lib/python2.6/dist-packages
You can fix it using three ways (Use only one of those, the first is the best):
move the
cv.so
file from thesite-packages
to thedist-packages
:
sudo mv /usr/local/lib/python2.6/site-packages/cv.so /usr/local/lib/python2.6/dist-packages/cv.so
However, both the site-packages as well as dist-packages, for both 2.7 and 3.2 are empty.
What went wrong and how do i solve it ?
Upvotes: 5
Views: 15039
Reputation: 4114
I solved the problem by installing all the packages and dependencies again using the Software Center. OpenCV Python bindings are available for OpenCV 2.3 and Python 2.7 directly from the software center which I used the second time.
OpenCv python bindings for 3.2 are not available for 12.04. They are being developed for Raring (Ubuntu 13.04) only. Hence, the solution is to use either backports, or to use OpenCv on Python 2.7
Backports also have a problem as they are available only for 32 bit OS systems and not 64 bit.
So, the only safe and stable way to run OpenCV Python on Ubuntu seems to be using OpenCV 2.3 on Python 2.7
Upvotes: 4
Reputation: 9935
I also get the empty dist-packages folder with OpenCV2.4.4 and Ubuntu 12.04. It turns out that I need to install python-dev
and python-numpy
in order to make the cv.so compiled into the dist-packages.
sudo apt-get install python-dev python-numpy
After that, using cmake
to build OpenCV again and everything will be fine
UPDATE it depends on your system pretty much.
dist-packages
and site-packages
. Searching around and then finally, it turned out that I have to have python-dev and python-numpyUpvotes: 2