This error will happen whenever your python OpenCV is not installed. So you just need to install it using “pip” or make CV2 library using cmake and copy that to your python library folders. Pip is a really good tool to install python packages and you can find a very good tutorial here.

To install OpenCV libarary just run the below in cmd or terminal according to your OS.

>> pip install python_opencv


>>python -m pip install python_opencv

To check that the installation was successful go to pythonshell and import it. no Error should be appear just like below.