Get the App
SLTechnology News&Howtos  ›  Development  › 

How to improve the Speed of pipinstall in python

Shulou Source: shulou.com Published: 2022-06-03 13:20:43 09月19日 Update

This article mainly explains "how to improve the speed of pipinstall in python". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to improve the speed of pipinstall in python.

Pip install command is used by default is python official source, due to some objective reasons, the connection speed is very slow, or even time-out interruption, when many modules can not be installed, very distressed!

What shall I do?

Using the domestic mirror source, copy the following command, paste it into notepad, save it as a bat file, and double-click to execute the batch file.

@ echo offrem declares that it uses UTF-8 encoding chcp 65001echo\ * echo to automatically set the pip installation configuration file echo\ * *\ * set pipFolder=\\ pip\\ if exist% userprofile%%pipFolder% (echo directory% userprofile%%pipFolder% already exists without creating) else (echo creates% userprofile%%pipFolder%md% userprofile%%PiPFolder%) Cd% userprofile%%pipFolder%echo\ [global\] > pip.ini (echo timeout=60echo index-url= http://pypi.douban.com/simpleecho extra-index-url= https://pypi.tuna.tsinghua.edu.cn/simple/echo\ [install\] echo trusted-host=pypi.douban.comecho pypi.tuna.tsinghua.edu.cnecho timeout= 10) > > pip.iniwmic ENVIRONMENT where "name='path' and username=''" set VariableValue= "% path% % userprofile%%pipFolder%pip.ini "

Then try the pip install command, which feels absolutely like flying.

In addition, I will give you some commonly used domestic sources of pip:

Aliyun https://mirrors.aliyun.com/pypi/simple/ https://pypi.mirrors.ustc.edu.cn/simple/ of University of Science and Technology of China (douban) https://pypi.douban.com/simple/ https://pypi.tuna.tsinghua.edu.cn/simple/ of Tsinghua University https://pypi.mirrors.ustc.edu.cn/simple/ of University of Science and Technology of China

Usage

Add the parameter-I when it is used in temporary effect

Such as:

Pip install matplotlib-I https://mirrors.aliyun.com/pypi/simple/

Take effect permanently

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

The contents are as follows:

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

Under 2.windows, create a pip directory directly in the user directory, such as C:\ Users\ xx\ pip, and create a new file pip.ini. The content is same as above.

At this point, I believe you have a deeper understanding of "how to improve the speed of pipinstall in python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: File speed content command university folder directory method China learning practical deeper distressed method of use interest then reason parameter official practicality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi Microsoft OPPO Reno Shulou Tech Info