我的博客
欢迎来到我的博客
bunny.icu

pip安装库报错:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))

pip安装库报错:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))

Error

C:\Users\win10\Desktop\BP-Network>pip install numpy
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/numpy/
ERROR: Operation cancelled by user

解决方法1

执行以下两条命令即可

pip config set global.index-url http://pypi.douban.com/simple
pip config set install.trusted-host pypi.douban.com

在Windows下,这两条命令相当于修改了pip的配置文件%appdata%/pip/pip.ini

所以手动修改%appdata%/pip/pip.ini文件,改为以下内容也是可以的:

[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

解决方法2(不推荐)

在pip install numpy后面加软件源并对该存储库给予信任,这种方式是可行的。

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

但是每次安装都需要加后面一大串有些繁琐,将pip下降为20.2版本就可以避免上述问题。

python -m pip install pip==20.2

如果报错,可以尝试用:

python -m pip install pip==20.2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

这样就能将pip降到20.2了,然后就可以用pip install 来顺利安装库了。

Reference

在python中安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
pip安装库报错:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) – CSDN
解决 pip 安装第三方包时因 SSL 报错 – 乐园
Windows下更换pip源为清华源 – CSDN

转载于https://blog.csdn.net/qq_41684249/article/details/110505807 有删改
没有标签
首页      Python      pip安装库报错:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))

推荐文章

发表评论

textsms
account_circle
email

bunny.icu

pip安装库报错:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
Error C:\Users\win10\Desktop\BP-Network>pip install numpy WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broke…
扫描二维码继续阅读
2022-11-15