When I use ‘pip install xxx’ command to install a python package, the pip command will download the package from https://pypi.org/simple and then install it. However, downloading packages from the URL https://pypi.org/simple is relatively slow from China. I recommend to use a pypi mirror in China to speed up the package download process. For example, the pypi mirror maintained by aliyun is a good candidate. The steps are as below:
1. Create the below file under the home directory of the current user.
.config/pip/pip.conf
2. Add the below content to the above file.
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
trusted-host = mirrors.aliyun.com
After this configuration is done, the pip command will download python packages from the pypi mirror maintained by aliyun. The download speed will much faster than before.