• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

工具践习

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

pip镜像源

镜像源

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

临时使用指定镜像

# 使用-i参数指定镜像地址
pip install 包名 -i 镜像源地址
# 例如:
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

设置全局镜像源(linux/Mac)

# 配置文件地址(没有则创建)
~/.pip/pip.conf
# 内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

设置全局镜像源(windows 当前用户)

# 配置文件地址(没有则创建)
C:\Users\{用户名}\pip\pip.ini
# 内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

查看镜像地址

pip config list
# 结果(如果没有配置则什么都不会显示)
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='pypi.tuna.tsinghua.edu.cn'

更多命令

# 详见(未深入研究)
pip config -h

posted on 2024-05-23 21:49  追梦的蒲公英  阅读(14)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3