1、再Users/XXX/下创建.pip文件夹和pip.conf文件
cd ~
mkdir .pip
cd .pip
touch pip.conf
2、编辑pip.conf文件
sudo vim pip.conf
3、再文件内容里面填入自己想要的源
#阿里云
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
#清华
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
*还有一种安装的方法就是在Pycharm里面安装