对于ubuntu系统
#建立pip配置文件夹
mkdir ~/.pip
cd ~/.pip
#建立pip配置文件
touch pip.conf
gedit pip.conf
#在pip.conf中写入一下两句:
[global] trusted-host = pypi.tuna.tsinghua.edu.cn
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
#保存关闭
#安装需要的软件
pip install [包名]
对于任意系统
#如果想临时使用:
#[包名]处填写需要安装的包名,如tensorflow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple [包名]
#如果想设为默认:
#升级 pip 到最新的版本
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
#设置源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
#安装需要的软件
pip install [包名]