Regardless of whether it is pip or pip3, the method is the same, namely: create a pip folder, the code is as follows
mkdir ~/.pip
vim ~/.pip/pip.conf
Involved in vim, refer to the article: Vim Command Daquan
Enter the pip.conf file and modify the link after index-url= to be a domestic source (at the end of the article). If the download speed does not change, you can change the code after trusted-host= to be the same as index-url
[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn
List of domestic sources
Alibaba Cloud http://mirrors.aliyun.com/pypi/simple/
University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/
Douban http://pypi.douban.com/simple
Python official https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
Chinese Academy of Sciences http://pypi.mirrors.opencas.cn/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/