之前在ubuntu下安装过,这次想在windows平台弄一个结果忘记怎么搞了,总是出错。
(DL) C:\Users\Administrator>conda install -c menpo opencv3
Fetching package metadata …
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- opencv3 -> python 2.7*
- python 3.6*
Use “conda info < package >” to see the dependencies for each >package.
提示opencv3支持python2.7不支持python3.6,明明之前装好的,后来想想估计是opencv3版本比较模糊,要指定个具体版本的。
改用下面的安装命令,不指定版本了,让系统自动推荐最新的opencv
conda install -c menpo opencv
OK
(DL) C:\Users\Administrator>conda install -c menpo opencv
Fetching package metadata …
Solving package specifications: .
Package plan for installation in environment D:\Miniconda3\envs\DL:
The following NEW packages will be INSTALLED:
hdf5: 1.8.20-hac2f561_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
icc_rt: 2017.0.4-h97af966_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libopencv: 3.4.2-h20b85fd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtiff: 4.0.9-h36446d0_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
opencv: 3.4.2-py36h40b0b35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
py-opencv: 3.4.2-py36hc319ecb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
The following packages will be UPDATED:
libpng: 1.6.30-vc14_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free --> 1.6.34-h79bbb47_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
Proceed ([y]/n)? y
哦,我用的清华镜像,安装速度贼快。
最后测试一下,没问题。
import cv2
img = cv2.imread(r'F:\Pictures\tiger.jpg')
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()