pip replaces domestic sources (solutions for pip installation of third-party libraries timeout failure)

When using pip to install some third-party python libraries, I often encounter slow speeds and timeouts that cause the installation to fail.This is because pip uses foreign sources to download by default, and it can be solved by changing the default source to a domestic mirror website.

Some domestic mirrors of pip

Ali cloud http://mirrors.aliyun.com/pypi/simple/
https://pypi.mirrors.ustc.edu.cn/simple/ University of Science and Technology of China
watercress https://pypi.douban.com/simple/
Tsinghua University University https://pypi.tuna.tsinghua.edu.cn/simple/University of
Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/

Modification method

  • linux
    modify ~/.pip/pip.conf (create one if not), the content is as follows:

    [global]
    index-url = https://pypi.douban.com/simple/
    
  • Windows
    creates a pip directory directly in the user directory, such as: C:\Users\xx\pip, create a new file pip.ini with the same content

Guess you like

Origin blog.csdn.net/zzh2910/article/details/79990916