Conda安装opencv4.5和opencv-contrib

1.conda创建虚拟环境(可选)

conda create -n pytorch python=3.8

更多细节,可参考博客

2.激活虚拟环境(可选)

conda activate pytorch 

3.安装opencv-python

pip install opencv-python==4.5.1.18

注:不带版本号的话,默认安装最新版。带版本号的话一定要确定有此版本,否则找不到该版本。
更过细节,可看opencv-python官网

4.安装opencv-contrib-python

pip install opencv-contrib-python==4.5.1.48

笔者的安装过程记录如下:
(pytorch) E:\anaconda3>pip install opencv-python
Collecting opencv-python
Downloading opencv_python-4.5.1.48-cp38-cp38-win_amd64.whl (34.9 MB)
|████████████████████████████████| 34.9 MB 82 kB/s
Collecting numpy>=1.17.3
Downloading numpy-1.19.5-cp38-cp38-win_amd64.whl (13.3 MB)
|████████████████████████████████| 13.3 MB 81 kB/s
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.19.5 opencv-python-4.5.1.48

opencv的使用,可参阅官方文档

你可能感兴趣的:(python,opencv,opencv-contrib,conda)