opencv-python has been installed, but the reason why import cv2 still fails

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 

 

Guess you like

Origin blog.csdn.net/weixin_48747603/article/details/127119725