Ubuntu18.04设置pip3所使用的源

创建文件~/.pip/pip.conf,在其中添加如下内容:

[global]
# 阿里云
index-url = https://mirrors.aliyun.com/pypi/simple/ 
# 清华大学
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
# 中国科技大学
# index-url = https://pypi.mirrors.ustc.edu.cn/simple/ 
# 豆瓣
# index-url = http://pypi.douban.com/simple 
# Python官方
# index-url = https://pypi.python.org/simple/ 
# v2ex
# index-url = http://pypi.v2ex.com/simple/ 
# 中国科学院
# index-url = http://pypi.mirrors.opencas.cn/simple/ 

保存,就可以了。
上面列出来的是好几个源,你可以在不同的源之间进行切换,我这里使用的是清华大学的源。

上面http的地方可能需要改成https,我没有完全测试。

临时指定源可以使用下面的命令:

pip install --user pythonModuleName -i https://mirrors.aliyun.com/pypi/simple/ 
posted @ 2020-09-09 22:13  南宫二狗  阅读(682)  评论(0编辑  收藏  举报