pip switch to domestic source

Domestic source

Temporary use

Add parameters when using pip -i https://pypi.tuna.tsinghua.edu.cn/simple
For instance: pip install -i http://mirrors.aliyun.com/pypi/simple/ tensorflow

Permanent use

Configuration file

  • Linux

modify ~/.pip/pip.conf
The content is as follows:

1
2
3
4
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
  • Windows

Create a pip directory in the users directory, then new file pip.ini
For instance: C:\Users\12439\pip\pip.ini
Content same as above

Check the configuration

Enter the following command in cmd

1
pip config list

Check the configuration


pip switch to domestic source
https://www.hardyhu.cn/2022/01/09/pip-switch-to-domestic-source/
Author
John Doe
Posted on
January 9, 2022
Licensed under