pip安装软件的时候出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))…………

pip安装时软件时报错:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionErrondor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fac903128d0>: Failed to establish a new connection: [Errno 101]',)': /simple/pip/

一、原因
pip的时候各种关卡限制了它的网速,导致网速过慢或者安装失败

二、解决方法(一劳永逸)
国内的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/

通过配置文件自动调取默认的源,经实测,速度杠杠,方法如下:
1.在windows中
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini
在这里插入图片描述
添加内容

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

2.Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
在文件上写入上面配置文件中的内容

发布了121 篇原创文章 · 获赞 60 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/weixin_43279032/article/details/104748128
今日推荐