OpenCv 配置安装 (使用Anaconda)
2023-08-26 本文已影响0人
程序猿峰岑
环境是基于Window操作系统
下载Anaconda 下载链接
默认安装路径
C://ProgramData/Anaconda3
按Window键会出现如下界面,双击Anaconda Prompt

此时输入cd C://ProgramData/Anaconda3 进入到该目录
然后输入python,查看python版本信息

Anaconda安装其他应用是在Scripts目录下,因此使用cd Scripts
dir:查看安装的应用目录
pip list: 查看安装的应用和版本号
Anaconda安装opencv-python命令
pip install opencv-python==版本号
例如:pip install opencv-python==3.4.18.65
国内需要使用镜像安装opencv-python,不然会报错
使用anaconda镜像安装命令
pip install opencv-python==3.4.18.65 -i 镜像地址
常用镜像地址
清华镜像:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
例如:
我们以清华镜像为例

检验opencv-python安装

除了opencv-python,我们还需要安装opencv-contrib-python
pip install opencv-contrib-python==3.4.18.65 -i https://pypi.tuna.tsinghua.edu.cn/simple