Python安装包、使用包、卸载包

安装包

pip install opencv-python 

使用国内镜像源-加速安装

豆瓣镜像

-i 表示镜像源
--trusted-host 信任网站
--user 表示管理员权限

pip install opencv-python -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --user

在这里插入图片描述
指定版本

pip install opencv-python==4.12.0.88
pip install opencv-python==4.12.0.88 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --user

二 使用包

import cv2

img = cv2.imread(r'D:\1.jpg')

cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows() 

在这里插入图片描述

三 卸载库

pip uninstall opencv-python

在这里插入代码片

更多推荐