How to let pip install Python packages using domestic sources

Urls to domestic sources

清华: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/

note:new version ubuntu require using sources of https.

Temporary using

Add “-i https://pypi.tuna.tsinghua.edu.cn/simple” to the end of command when using pip;
For example: “pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider”. by this way, we can install the pyspider from tsinghua’s sources.

Long-term using

If our OS is Linux, we should change content of the file whose path is " ~/.pip/pip.conf",the contents are as follows:

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

If we are using windows,we should create a directory in “User” directory, then create a file names “pip.ini” in the directory,(for example: C:\Users\QWER\pip\pip.ini).The content is the same as above.

Via: http://www.cnblogs.com/microman/p/6107879.html

猜你喜欢

转载自blog.csdn.net/u012495579/article/details/88537961
今日推荐