pip安装cv2时出现一下错误:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError...
分析问题:
1)网络出现了问题导致安装时与pip安装源网站连接超时,无法下载安装指定的第三方库
2)pip安装源默认是国外的网址,在安装时,可能会出现访问慢导致连接超时,无法下载安装第三方库
解决办法: 指定源,命令如下
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
换源:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set install.trusted-host mirrors.aliyun.com
国内的pip源:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/