Changing the pip Source#
Original Repository
https://pypi.org/simple/
pip Mirror Sources#
Common Sites:
Alibaba Cloud https://mirrors.aliyun.com/pypi/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
Nanjing University https://mirror.nju.edu.cn/pypi/web/simple/
Campus Network Union Mirror Station mirrorz-302 Smart Selection https://mirrors.cernet.edu.cn/pypi/web/simple/
Douban http://pypi.douban.com/simple/
Tencent http://mirrors.cloud.tencent.com/pypi/simple/
Huawei https://repo.huaweicloud.com/repository/pypi/simple/
Campus Network Union Mirror Station:
- PyPI Software Repository Mirror Usage Guide https://help.mirrors.cernet.edu.cn/pypi/
The synchronization of the mirror station and university mirrors may be slower. If you need the latest pypi library, you can use the original repository https://pypi.org/simple
Changing the Source#
1. Temporary Source Change#
pip install -i https://mirrors.aliyun.com/pypi/simple/ package_name
If the project contains a file similar to requirement.txt
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt -i https://mirror.nju.edu.cn/pypi/web/simple/
2. Permanent Source Change#
Linux Environment Source Change (System pip)#
Create or open ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = https://mirrors.aliyun.com
Windows System#
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
References:
https://zhuanlan.zhihu.com/p/551940762
https://blog.csdn.net/weixin_44621343/article/details/116459859