Using a Chinese PyPI Mirror
Instructions for selecting and configuring a Chinese PyPI mirror in pip for temporary or persistent use.
PyPI connections can be slow or blocked in China, which makes pip inconvenient to use. A system-wide proxy is one solution; another is to use a domestic PyPI mirror.
These mirrors were available when this note was written:
The Tsinghua mirror updates every five minutes and is fast, so I recommend it.
Temporary use
sudo pip install <package-name> -i https://pypi.tuna.tsinghua.edu.cn/simpleDefault use
Edit ~/.pip/pip.conf with elevated privileges, creating it if necessary, and add:
[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple