OpenCV erfolgreich installiert, ABER ImportError: No module named 'cv2'
So, ich habe erfolgreich installiert OpenCV 3.2.0
von der Quelle auf Ubuntu 14.04
und ich bekomme diese Fehlermeldung:
(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'
Was soll ich getan haben, nach sudo make install
Schritt, den ich verpasst haben könnte?
Leider gibt es keine cv2 hier:
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
Sie haben die
Ich kann mich nicht erinnern, über Ihre zweite Frage, aber CMAKE wurde erfolgreich abgeschlossen und die
Was ist, wenn Sie laufen
nvm ich hatte bereits
Was passiert, wenn Sie laufen
python3-dev
Paket installiert? Wenn Sie lief cmake
, es zu sagen, es ging zu installieren python 3 bindings?Ich kann mich nicht erinnern, über Ihre zweite Frage, aber CMAKE wurde erfolgreich abgeschlossen und die
$ sudo pip3 install python3-dev Downloading/unpacking python3-dev Could not find any downloads that satisfy the requirement python3-dev Cleaning up... No distributions at all found for python3-dev Storing debug log for failure in /home/mona/.pip/pip.log
Was ist, wenn Sie laufen
sudo apt-get install python3-dev
?nvm ich hatte bereits
Reading package lists... Done Building dependency tree Reading state information... Done python3-dev is already the newest version. python3-dev set to manually installed. The following package was automatically installed and is no longer required: libxine1-bin Use 'apt-get autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Was passiert, wenn Sie laufen
python2 -c "import cv2"
?InformationsquelleAutor Mona Jalal | 2017-01-19
Du musst angemeldet sein, um einen Kommentar abzugeben.
Habe ich über das gleiche problem bei der Installation von openCV auf dem Raspberry Pi-3 nach dieser Anleitung:
http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
Das Problem war, dass die cv2.so installierte Datei in "/usr/local/lib/python2.7/dist-packages/" statt "/usr/local/lib/python2.7/site-packages/".
Die Lösung für mich war einfach die Datei kopieren mit diesem Befehl:
"sudo cp /usr/local/lib/python2.7/dist-packages/cv2.also /usr/local/lib/python2.7/site-packages/cv2.so"
Hoffe, das hilft.
InformationsquelleAutor Slashy
Bewegen Sie den cv2.also Datei von dist-packages zu site-packages wie vorgeschlagen von Slashy. Es war für mich
InformationsquelleAutor Aditya Deshpande