Detailed steps to install opencv in pycharm

  1. open pycharm

  1. Find the terminal/terminal at the bottom of the pycharm software

  1. click

  1. Enter in the opened interface

pip install opencv-contrib-python

If the following icon appears

run directly 8

  1. 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
  1. A text similar to the one in the picture below is successful (the last sentence is enough)

  1. 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

Guess you like

Origin blog.csdn.net/this_dudu/article/details/128772212