+1 vote
in Programming Languages by (8.6k points)

'import cv2' gives the following error:

ImportError: No module named 'cv2' 

How to fix this error? 

1 Answer

0 votes
by (16.9k points)

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

...