Linux平台
在~/.pip/pip.conf
创建一个 pip.conf
文件
写入以下内容:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
trusted-host
此参数是为了避免麻烦,否则使用的时候可能会提示不受信任,也可以不添加。
Window平台
user用户目录中创建一个名为 pip 的文件夹,在 pip 文件夹中创建一个名为 pip.ini
的文本文件
写入的内容同 Linux平台 一样
其它国内源
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://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/
note:新版ubuntu要求使用https源,要注意