modulenotfounderror no module named cv2

0 votes

Cannot find module cv2 when using OpenCV

I have successfully downloaded the  OpenCV on the Occidentalis operating system which is nothing but a variant of Raspbian on a Raspberry Pi by using the script of jayrambhia which I found here and I have installed version 2.4.5.

While trying to import cv2 in a Python program, I get the following message:

pi@raspberrypi~$ python cam.py 
Traceback (most recent call last) 
File "cam.py", line 1, in <module> 
        import cv2 
ImportError: No module named cv2

The file cv2.so is stored in /usr/local/lib/python2.7/site-packages/… Which means that there are additional folders in /usr/local/lib called python3.2 and python2.6 which will serve as a problem but I'm not sure whether this is a path error. Could I get some help on this please as I am new to Linux?

Feb 8, 2022 in Python by Rahul
• 9,680 points
2,498 views

1 answer to this question.

0 votes

Firstly, please do run these following commands inside the Terminal or CMD:

conda update anaconda-navigator conda update navigator-updater

Following which, the problem for the instruction provided below will be resolved. For a windows system, if one has the anaconda software installed, you can simply try this:- 

pip install opencv-python or conda install -c https://conda.binstar.org/menpo opencv

If you are using the linux software, then you can try:

pip install opencv-python or conda install opencv

Finally, if you are using the anaconda software, then you may simply use this as well excluding the need to add the menpo channel:-
 

conda install -c conda-forge opencv

answered Feb 8, 2022 by Soham
• 9,710 points

Related Questions In Python

+3 votes
3 answers

ModuleNotFoundError: No module named 'cv2'

Hi@akhtar, This error may occur if you didn't install ...READ MORE

answered Apr 9, 2020 in Python by MD
• 95,460 points
270,502 views
0 votes
1 answer

ModuleNotFoundError: No module named 'cv2'

Check if it's installed properly, It will work ...READ MORE

answered Oct 12, 2020 in Python by Gitika
• 65,890 points
4,389 views
+1 vote
3 answers
+2 votes
3 answers

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

answered Aug 20, 2019 in Python by Raman
80,711 views
0 votes
1 answer
0 votes
2 answers

ModuleNotFoundError: No module named 'pythoncom' in pyttsx3

even i faced the same problem ...just ...READ MORE

answered Jun 2, 2020 in Python by anonymous
13,856 views
0 votes
1 answer

Cannot find module cv2 when using OpenCV

This is because python is not able ...READ MORE

answered Apr 30, 2022 in Other DevOps Questions by narikkadan
• 63,680 points
600 views
0 votes
1 answer

Section postgresql not found in the database.ini file

Python doesn't know what $FILEDIR is. Try an absolute path ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 58,100 points
3,622 views
0 votes
1 answer

Iterating over dictionaries using 'for' loops

key is just a variable name. for key ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,300 points
972 views
0 votes
1 answer

Conflicting dependencies of pypyodbc and blpapi

I figured out that pypyodbc only works ...READ MORE

answered Oct 9, 2018 in Python by Priyaj
• 58,100 points
730 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP