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 ?
The Python "ModuleNotFoundError: No module named 'cv2'" occurs when we forget to install the opencv-python module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install opencv-python command.
By default OpenCV will be installed to the /usr/local directory, all files will be copied to following locations: /usr/local/bin - executable files.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With