python切换pip源

女爷i 2024-03-27 15:53 154阅读 0赞

方式一
执行命令 进行更换源 以清华源为例:

  1. pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

移除更换的源

  1. pip config unset global.index-url

方式二
在用户目录中创建 pip.config
路径 ~/.config/pip/pip.conf ,添加内容如下

  1. [global]
  2. index-url = https://pypi.tuna.tsinghua.edu.cn/simple

方式三 (不更换源,配置代理)
直接在pip命令中使用代理

  1. pip install --proxy=http://127.0.0.1:1080

源地址:

清华源:
https://pypi.tuna.tsinghua.edu.cn/simple
阿里云源:
http://mirrors.aliyun.com/pypi/simple/
中科大源:
https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣源:
http://pypi.douban.com/simple/

链接:https://www.jianshu.com/p/2fad6da4721d
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

发表评论

表情:
评论列表 (有 0 条评论,154人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Python pip

    Python pip源 用pip管理工具安装库文件时,默认使用国外的源文件,因此在国内的下载速度会比较慢,因此使用国内的镜像。其中,比较常用的国内镜像包括: 阿里