临时
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn xxxx
设为默认
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
或者创建或编辑配置文件
linux文件位置:~/.pip/pip.conf
windows文件位置:C:\Users\用户名\pip\pip.ini或C:\Users\用户名\AppData\Roaming\pip\pip.ini
文件内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn
常用镜像源
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/