使用命令修改Python的PIP源

使用命令修改PIP源有两种方法:

1. 临时修改

示例:使用清华源安装numpy

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy

2. 永久修改

示例:将pip源永久替换为阿里,并使用新源安装numpy

# 配置源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

# 安装numpy
pip install numpy 

附:国内常用源

# 清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
# 豆瓣源
pip config set global.index-url http://pypi.douban.com/simple/
posted @ 2021-04-11 15:42  丿踏遍青山人未老  阅读(1277)  评论(0编辑  收藏  举报