安装软件
sudo apt install python3 	//确保虚拟机只有python3  ln -sf /usr/bin/python3.6 /usr/bin/python
sudo apt install python3-pip
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple编写python代码
import cv2
image_path = "1.jpg"
img = cv2.imread(image_path)
if img is None:
    print("Error: Could not load image.")
    exit()
cv2.imshow("Display", img)
k = cv2.waitKey(0)
if k == 27:
    # 关闭所有 OpenCV 窗口
    cv2.destroyAllWindows()运行python代码
@ubuntu:~/opencv$ python3 picture.py