Hello, I’m Yue Chuang.

I’m going to sort out all the Python PIP source swap methods.

The first way

  1. Open the AppData folder and type in the address bar in Explorer%appdata%After enter:

2. Create a PIP folder and create a configuration file in the PIP folderpip.ini:

3. Enter the following information in the configuration file and save the configuration:

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
Copy the code

When PIP is used again, the new source is used.

Some common domestic sources:

  • Tsinghua university: pypi.tuna.tsinghua.edu.cn/simple

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

  • University of science and technology of China pypi.mirrors.ustc.edu.cn/simple

  • Douban: pypi.douban.com/simple

The second way

The third way

Starting with PIp10.0.0, a config subcommand is available to change the configuration, regardless of the configuration file path on different operating systems.

See discussion: link.zhihu.com/?target=htt…

Practical examples:

PIP configsetGlobal. The index - source url http://mirrors.aliyun.com/pypi/simple/ # douban PIP configsetGlobal. The index - url https://pypi.douban.com/simple # # ali cloud http://mirrors.aliyun.com/pypi/simple/ university of science and technology https://pypi.mirrors.ustc.edu.cn/simple/ # douban (douban) http://pypi.douban.com/simple/ # at tsinghua university in Beijing https://pypi.tuna.tsinghua.edu.cn/simple/ # http://pypi.mirrors.ustc.edu.cn/simple/ university of science and technology of ChinaCopy the code

reference

  1. Data analysis environment doesn’t match? Look at this! : www.aiyc.top/772.html.
  2. For Linux, PIP uses a domestic source: www.aiyc.top/153.html
  3. In Windows, replace the PIP source with the Tsinghua source: www.aiyc.top/1657.html