pip acceleration + Baidu mirror | Tsinghua mirror

In view of the slow download of the pip install installation package, the main direct installation of pip install is to pull the installation package from abroad.
The solution is to add a domestic mirror, such as Baidu https://mirror.baidu.com/pypi/simple

pip install lac -i   https://mirror.baidu.com/pypi/simple

For example, Tsinghua mirror: https://pypi.tuna.tsinghua.edu.cn/simple

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

How to speed up pip download

The reason why pip is slow is that it uses a unified foreign download source by default, so if you want to speed up the download speed of pip, a feasible way is to switch the download source to domestic. Some large domestic companies also provide corresponding competing websites.

Domestic mirror website

Instructions

 pip install [包名] -i [ftp站名地址] --trusted-host [ftp站点名]

   
    
    
  • 1

Take the installation of numpy as an example, if you use Ali's source, you can enter the command like this

pip install numpy -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

   
    
    
  • 1

If you use the source of Douban, you can enter the command like this

pip install numpy -i  http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

   
    
    
  • 1

Other similar...

If you want to do it once and for all, maybe

alias pyinstall='pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com '

   
    
    
  • 1

After putting this alias in /etc/bash.bashrc or ~/.bashrc, you can no longer add the following parameters when calling pyinstall, and the word install is also omitted.

How to speed up pip download

The reason why pip is slow is that it uses a unified foreign download source by default, so if you want to speed up the download speed of pip, a feasible way is to switch the download source to domestic. Some large domestic companies also provide corresponding competing websites.

Domestic mirror website

Instructions

 pip install [包名] -i [ftp站名地址] --trusted-host [ftp站点名]

   
  
  
  • 1

Take the installation of numpy as an example, if you use Ali's source, you can enter the command like this

pip install numpy -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

   
  
  
  • 1

If you use the source of Douban, you can enter the command like this

pip install numpy -i  http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

   
  
  
  • 1

Other similar...

If you want to do it once and for all, maybe

alias pyinstall='pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com '

   
  
  
  • 1

After putting this alias in /etc/bash.bashrc or ~/.bashrc, you can no longer add the following parameters when calling pyinstall, and the word install is also omitted.

Guess you like

Origin blog.csdn.net/stay_foolish12/article/details/107484691