亲测有效!
转自:https://blog.csdn.net/qq_42372629/article/details/97773205?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
# 1 在当前用户主目录下创建.pip文件夹
sudo mkdir ~/.pip
# 2 在~/.pip文件夹下创建pip.conf
sudo vi ~/.pip/pip.conf
输入以下内容后保存:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn