How to make the installation of speed pip take-off (effective pro-test)


As long as the language used python, pip will need to install some third-party libraries, but the default pip mirror source is abroad, download speed is slower than a snail, only a few k's speed, but also because even during the download time-out exit, after downloading the installation error, like me, you have not kept straining to hit the Enter key it? Internet is a lot, put his pro-test effective way to tidy up share

Domestic mirror source

Commonly used domestic mirror source:

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

Ali cloud: http: //mirrors.aliyun.com/pypi/simple/

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

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

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

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

I often use a mirror source Tsinghua University, Tsinghua University here also to set an example, right mirror source

linux environment

temporary use

During the installation package in the back pip additional parameters "-i", then add the source you want to use, we have to install the "jieba" A Case Study

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jieba

This will jieba to download from Tsinghua mirror source, a lot of it faster

Permanent

Under Linux, modify ~ / .pip / pip.conf (not just create a folder and file folders to add. "" Indicates a hidden folder)

[root@VM_0_5_centos ~]# vim ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

windows environment

temporary use

And temporary use of linux, as long as the specified image source can be mounted when

Permanent

The windows need to create a pip directory user's folder, and then create a pip.ini In this pip folders, such as My path is: C: \ Users \ rcoons \ pip. Pip.ini then edit the file:

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

You can use Notepad ++ editor pip.ini file
through the set-top, and then after the pip to download and install third-party libraries when the speed is much faster

Published 21 original articles · won praise 28 · views 3706

Guess you like

Origin blog.csdn.net/LPJCSY/article/details/105042083