python安装过程中Retrying (Retry(total=4, connect=None……after connection broken by 'ReadTimeoutError……

一、报错描述

在安装的时候报错:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/opencv-python/

二、对错误原因的猜想

1、今年已经是2020年,python2版本已经要告别了。当一台电脑同时有多个版本的Python的时候,用pip3就可以自动区分用Python3来安装库。是为了避免和Python2发生冲突的。

可行解决方法一(快准狠): 

使用豆瓣源,因为豆瓣源是不可信所以应该从pip install -i https://pypi.douban.com/simple/ 包名   改成:

pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
 

可行解决方法二(慢而错误多):

使用命令:

pip3 install 包名

可以正常进行安装,ERROR是因为版本太低了。

升级一下

python -m pip install --upgrade pip

报错:socket.timeout: The read operation timed out 。然后设置默认超时时间

pip --default-timeout=100 install -U 包名

有问题可以评论补充

发布了46 篇原创文章 · 获赞 75 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_38875300/article/details/103894460