pip切换国内源(解决pipenv lock特别慢)

20200702 

mint20

官方文档:

https://pip.pypa.io/en/stable/user_guide/

建立配置文件

如果是linux

sudo xed /etc/pip.conf

 发现必须设置成Site-wide .  Per-user并不work

老版是这样,现在不起作用了

切换方法参考https://blog.csdn.net/chenghuikai/article/details/55258957

实测,确实解决了pipenv这个问题,否则只能--skip-lock。

基本抄录一下

~/.pip/pip.conf

如果是win

C:Usersxxpippip.ini

没有pip文件夹的话,就自己创建

mkdir  ~/.config/pip

mkdir ~/.pip 

内容如下:

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

备用方法 

sudo pip3 install XXX -i https://pypi.tuna.tsinghua.edu.cn/simple

默认是

https://pypi.org/simple

其他http://mirrors.aliyun.com/pypi/simple/

https://pypi.tuna.tsinghua.edu.cn/simple

建好之后无须重启注销,直接pipenv起飞 

如果win下还是慢,注意xx-net之类设置成“取消全局代理”。把pip文件开头的source也改成这个

[[source]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
原文地址:https://www.cnblogs.com/xuanmanstein/p/10122515.html