Mac OS 基于Python3.8安装OpenCV4

第一步安装Python(Linux和maxOS一般自带,win得自己装)

第二步:安装OpenCV
1、pip3 install opencv_python -i https://pypi.mirrors.ustc.edu.cn/simple/

2、倘若安装比较慢,可以使用国内的源,例如使用中科大的源:

pip3 install opencv-contrib-python -i https://pypi.mirrors.ustc.edu.cn/simple/

第三步:检查
调出终端,输入python3,回车
进入python后,输入import cv2,回车
不报错就说明安装成功
然后可以检查版本输入cv2.version,回车

附录:
几个常用的源网址:

https://pypi.tuna.tsinghua.edu.cn/simple/ # 清华大学
https://mirrors.aliyun.com/pypi/simple/ # 阿里云
https://pypi.douban.com/simple/ # 豆瓣
https://pypi.mirrors.ustc.edu.cn/simple/ # 中国科学技术大学
https://pypi.hustunique.com/ # 华中科技大学

猜你喜欢

转载自blog.csdn.net/KingOfOnePiece/article/details/125012539