pip的幺蛾子
1.pip的时候出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))…………
一、原因
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/
通过配置文件自动调取默认的源,经实测,速度杠杠,方法如下
在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
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
在文件上写入上面配置文件中的内容
————————————————
根据上边的配置安装如果出现一下错误信息
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'c:\\program files\\python\\Lib\\site-packages\\simplejson'
Consider using the `--user` option or check the permissions.
请根据提示添加 --user
例如:
pip install --user simplejson
原文链接:https://blog.csdn.net/cpc784221489/article/details/94214306
pip install --user simplejson