Let PIP source use domestic mirrors to improve download speed and installation success rate

Let the PIP source use domestic mirrors to improve the download speed and installation success rate.

For Python development users, PIP installation of packages is commonplace. But the download speed of foreign sources is too slow and a waste of time. And there are often problems with installation errors after downloading. Therefore, replacing the PIP installation source with a domestic mirror can greatly improve the download speed and the installation success rate.

Domestic source:

The new version of ubuntu requires the use of https sources, so be careful.

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

Aliyun: http://mirrors.aliyun.com/pypi/simple/

University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/

Huazhong University of Science and Technology: http://pypi.hustunique.com/

Shandong University of Technology: http://pypi.sdutlinux.org/ 

Douban: http://pypi.douban.com/simple/

temporary use:

You can add the parameter -i https://pypi.tuna.tsinghua.edu.cn/simple when using pip,

for example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider, so that The pyspider library will be installed from the mirror on Tsinghua.
 

Permanent modification, once and for all:

Under Linux, modify ~/.pip/pip.conf (create a folder and file without it. Add "." to the folder, which means it is a hidden folder)

The content is as follows:

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

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。

记录自己、分享公众、成就别人
作者:andyliulin 发表于 2018/01/02 16:48:00  原文链接 https://blog.csdn.net/andyliulin/article/details/78953325
阅读:176

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326155010&siteId=291194637