1 # 导入模块 2 import cv2 as cv 3 # 读取图片 4 img = cv.imread('C:/Users/87823/Desktop/tree.png') 5 # 显示图片 6 cv.imshow('r',img) 7 # 等待键盘输入 8 cv.waitKey(0) 9 # 释放内存 10 cv.destroyAllWindows()