Python pip换源方法

Python pip换源方法

  • 一、Windows下更换 `pip` 源
  • 二、Linux下更换 `pip` 源
  • 三、常用的国内源

一、Windows下更换 pip

  1. 打开 appdata 文件夹,在资源管理器的地址栏输入 %appdata% 后回车:

  1. 新建一个 pip 文件夹,在 pip 文件夹里面新建一个配置文件 pip.ini

  1. 在配置文件中输入如下内容后保存即可

[global]
timeout=6000
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host=pypi.tuna.tsinghua.edu.cn

再次使用 pip,即会使用新源

二、Linux下更换 pip

[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn

三、常用的国内源

  • 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple

  • 阿里云:https://mirrors.aliyun.com/pypi/simple

  • 中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple

  • 华中科技大学:http://pypi.hustunique.com

  • 豆瓣:http://pypi.douban.com/simple

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
乘风的头像乘风管理团队
上一篇 2023年9月15日
下一篇 2023年9月15日

相关推荐