fun with coding

王二啊哈哈

愿天下没有难做的预报

Python换pip源方法及常用国内源

1 常见国内pip源

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

阿里云:http://mirrors.aliyun.com/pypi/simple/

中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/ 

豆瓣:http://pypi.douban.com/simple/

2 永久更换

2.1 win下

在user下的用户目录创建一个pip目录,新建文件:pip.ini,写入:

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install] 

trusted-host=mirrors.aliyun.com

2.2 linux下

linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url 为国内镜像地址,如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

3 一次性使用

可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install SomePackage -i https://pypi.tuna.tsinghua.edu.cn/simple
这样就会从清华这边的镜像去安装SomePackage库。

posted @ 2019-10-21 00:02  王二啊哈哈  阅读(571)  评论(0编辑  收藏  举报