Enter the following command pip install opencv-python in the terminal and cmd will show that opencv-python has been installed
Note: Installing with pip install cv2 will display an error. Most of the reasons for the failure of the installation are the wrong input of the installation command.
It's actually a problem with the interpreter
Replacing the interpreter that has installed opencv can solve the problem
The location of the interpreter used in this project is shown in the figure:
The interpreter location of the installed opencv is shown in the figure:
Next is file ->setting ->project ->python interpreter
Just change the path
Then import cv2 will not report an error