Reputation: 38145
So I have successfully installed OpenCV 3.2.0
from source on Ubuntu 14.04
and I get this error:
(cv2) mona@pascal:~/computer_vision/opencv-3.2.0/build$ /usr/local/bin/opencv_version
3.2.0
(cv2) mona@pascal:~/computer_vision/opencv-3.2.0/build$ python
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv2'
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv'
What should I have done after sudo make install
step that I might have missed?
Unfortunately there's no cv2 here as well:
mona@pascal:~/computer_vision/opencv-3.2.0/build$ ls /usr/local/lib/python3.4/dist-packages/
clonevirtualenv.py numpy protobuf-3.1.0.post1.dist-info stevedore virtualenvwrapper
django numpy-1.12.0.egg-info protobuf-3.1.0.post1-py2.7-nspkg.pth stevedore-1.20.0.dist-info virtualenvwrapper-4.7.2-py3.4.egg-info
Django-1.10.5.dist-info olefile __pycache__ tensorflow virtualenvwrapper-4.7.2-py3.4-nspkg.pth
easy_install.py olefile-0.44-py3.4.egg-info PyYAML-3.12-py3.4.egg-info tensorflow_gpu-0.12.1.dist-info wheel
external OleFileIO_PL.py scipy theano wheel-0.29.0.dist-info
google pbr scipy-0.18.1-py3.4.egg-info Theano-0.8.2-py3.4.egg-info yaml
image pbr-1.10.0.dist-info setuptools virtualenv-15.1.0.dist-info
image-1.5.5-py3.4.egg-info PIL setuptools-33.1.1.dist-info virtualenv_clone-0.2.6-py3.4.egg-info
keras Pillow-4.0.0-py3.4.egg-info six-1.10.0.dist-info virtualenv.py
Keras-1.2.0-py3.4.egg-info pkg_resources six.py virtualenv_support
Upvotes: 2
Views: 8698
Reputation: 2004
Move the cv2.so file from dist-packages to site-packages as suggested by Slashy. It worked for me
Upvotes: 0
Reputation: 11
I've come across the same problem when installing openCV on Raspberry Pi 3 following this guide: http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
The issue was that the cv2.so file installed in "/usr/local/lib/python2.7/dist-packages/" instead of "/usr/local/lib/python2.7/site-packages/".
The solution for me was simply to copy the file with this command: "sudo cp /usr/local/lib/python2.7/dist-packages/cv2.so /usr/local/lib/python2.7/site-packages/cv2.so"
Hope this helps.
Upvotes: 1