Installing OpenCV, No module named cv2.cv
Solution 1
Are you sure the installation worked properly? Because all I see during your first step is:
cmake: command not found
checkinstall: command not found
So maybe you should check that both cmake
and checkinstall
are installed, or install them if they are not before retrying the opencv.sh
command:
sudo apt-get install cmake checkinstall
sudo ./opencv.sh
Solution 2
By installing python-opencv
package you should be able to solve the problem
sudo apt-get install python-opencv
lnhubbell
Updated on June 04, 2022Comments
-
lnhubbell almost 2 years
I am trying to follow the instructions found here for python.
Step 1 seemed to work, here are the last 5 lines from my terminal after I ran
opencv.sh
:h.h ./opencv.sh: line 16: cmake: command not found make: *** No targets specified and no makefile found. Stop. sudo: checkinstall: command not found OpenCV 2.4.9 ready to be used
However, when I moved on to step 2 I got the following error when running the python file from the command line:
Traceback (most recent call last): File "opencvFirst.py", line 4, in '<'module'>' from cv2.cv import * ImportError: No module named cv2.cv
This doesn't seem to be my issue, because I can't find cv2.anything located on my computer, which is most likely part of the problem, but I don't know why step 1 wouldn't have installed it.
I think that this question is a little closer to what I need, but since I already completed step 1, as I said above, I'm not sure where to start with these separate instructions. I tried
import cv2
but got an import error:no module cv2.
I'm very new to ubuntu, python, and all this command line stuff, thank you for your help!
Oh also, I should say: my final goal here is just to get OpenCV working, so if there is an easier/better way to do so, I am very open to suggestions.
-
lnhubbell almost 10 years'apt-get cmake' gives me: E: Invalid operation cmake, same for checkinstall