'import cv2' gives the following error:
ImportError: No module named 'cv2'
How to fix this error?
You need to install opencv module to fix this error. Try one of the following commands:
Python3
pip3 install opencv-pythonorsudo apt-get install python3-opencv
pip3 install opencv-python
or
sudo apt-get install python3-opencv
Python2
pip install opencv-pythonorsudo apt-get install python-opencv
pip install opencv-python
sudo apt-get install python-opencv