+2 votes
in Programming Languages by (73.8k points)

'import cv2' gives the following error:

ImportError: No module named 'cv2' 

How to fix this error? 

1 Answer

+2 votes
by (349k points)
selected by
 
Best answer

You need to install opencv module to fix this error. Try one of the following commands:

Python3

pip3 install opencv-python

or

sudo apt-get install python3-opencv

Python2

pip install opencv-python

or

sudo apt-get install python-opencv


...