Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to improve the Speed of pipinstall in python

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report