I recently installed and compiled openCV on my raspberrypi.
Now if I use the command import cv2 in my raspian OS (either in the python shell or the IDE) I get an error

no module named cv2 found but the same command works in the raspberrypi shell.

How do I resolve this??

  • File "home/pi/Desktop/FR.py",line 2,in module
  • import cv2
  • File "/usr/lib/python3/dist-packages/thonny/backend.py",line 305,in_custom_import
  • module=self_original_import(*args,**kw) ImportError:no module named 'cv2'

1 Answers

Rahila T - Intel On

Please try to run your code after executing the below command.

python -m pip install opencv-contrib-python