目前通过官方安装python后,通过pip安装第三方包,如pytest、requests等遇到提示:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000259D5CCE060>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000259D4E99DC0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest/      
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000259D5CCE300>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pytest/

问题原因:这明显是源连不上,换为国内的源即可

解决方法一:

pip install [whatyouwant] -i url

实例:pip install openpyxl -i http://pypi.douban.com/simple

如果给出提示:源不可信

则修改为:pip install [whatyouwant] -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
 

解决方法二:关闭代理

方法三:

重启计算机。。。。

题主就是装完python后没重启,总是报错,直接重启机器解决的!!!

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐