open pycharm
Find the terminal/terminal at the bottom of the pycharm software
click
Enter in the opened interface
pip install opencv-contrib-python
If the following icon appears
run directly 8
If the download speed is too slow, use any of the following codes
pip install opencv-contrib-python https://pypi.tuna.tsinghua.edu.cn/simple
A text similar to the one in the picture below is successful (the last sentence is enough)
Verify whether opencv-python is successfully installed code
import cv2
img = cv2.imread( )#空格里放你图片的地址,放地址之前把空格删除
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()#不写任何东西
Tips: 1. Do not have Chinese in the picture address
2. For example, to copy the image address: D:\Abaskrobot\imgs\foot, it should be changed to: D:/Abaskrobot/imgs/foot