Python包管理pip换源

  1. 查看当前使用的源信息
  2. 临时换源
  3. 永久换源

国内因为墙的问题,pip安装扩展,经常会提示错误或速度很慢,我们可以尝试切换为国内源

查看当前使用的源信息

pip config list

临时换源

# 清华源
pip3 install markdown -i https://pypi.tuna.tsinghua.edu.cn/simple

# 阿里源
pip3 install markdown -i https://mirrors.aliyun.com/pypi/simple/

# 腾讯源
pip3 install markdown -i http://mirrors.cloud.tencent.com/pypi/simple

# 豆瓣源
pip3 install markdown -i http://pypi.douban.com/simple/

永久换源

# 清华源
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/

# 换回默认源
pip config unset global.index-url

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 [email protected]

×

喜欢就点赞,疼爱就打赏