开发环境 - pip install cv2下载失败的解决办法

1. 出错现象
1.1 源代码import cv2失败

import cv2
ImportError: No module named cv2
 

1.2 conda install cv2 失败
(base) C:\Users\wenbingw>conda install cv2

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): failed

1.3 pip3 install cv2失败
(base) C:\Users\wenbingw>pip3 install cv2

ERROR: Could not find a version that satisfies the requirement cv2
ERROR: No matching distribution found for cv2

2. 出错原因
cv2现在已经不叫cv2了,而叫做opencv-python

3. 解决办法
pip3  install opencv-python
上述安装,虽然可以解决按照CV2, 但按照过程太慢,35M的东西需要一个多小时。可以换个安装方法:

(1)通过链接下载文件cv2,

https://pypi.tuna.tsinghua.edu.cn/simple/opencv-python/

(2)pip3 install ./opencv_python-4.5.5.62-cp36-abi3-win_amd64.whl

4. 效果验证

python
 
>> import cv2

你可能感兴趣的:(python,opencv,开发语言,人工智能,深度学习)