import cv2
An error is reported because it is not installedNo module named ‘cv2’
cmd+r first enter python, then enter import cv2 to check whether the cv2 library is installed
Import cv2 is used when importing packages, but the package name is not cv2 when installing
So enter the command to install:
pip install opencv_python
After returning, the following error was reported:
Solution:
input the command:
pip install opencv_python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Douban is quite stable, and you can download basic packages, but it’s a bit slower outside the country, at least it can still be used in most cases
When successfully and version number appear, the installation is successful
After the installation is successful, check the code again and find that the error is gone (^-^)V