当前位置: 首页 > news >正文

国内知名的几个镜像源

在国内,有许多常用的Python库镜像源可以帮助加速库的下载。以下是几个知名的镜像源:

1. 清华大学TUNA协会

  • 网址: https://pypi.tuna.tsinghua.edu.cn/simple
  • 命令示例:
    pip install numpy --index-url https://pypi.tuna.tsinghua.edu.cn/simple
    

2. 阿里云

  • 网址: http://mirrors.aliyun.com/pypi/simple/
  • 命令示例:
    pip install numpy --index-url http://mirrors.aliyun.com/pypi/simple/
    

3. 腾讯云

  • 网址: http://mirrors.cloud.tencent.com/pypi/simple/
  • 命令示例:
    pip install numpy --index-url http://mirrors.cloud.tencent.com/pypi/simple/
    

4. 华中科技大学

  • 网址: http://pypi.hustunique.com/
  • 命令示例:
    pip install numpy --index-url http://pypi.hustunique.com/
    

5. 中国科学技术大学

  • 网址: http://pypi.mirrors.ustc.edu.cn/simple/
  • 命令示例:
    pip install numpy --index-url http://pypi.mirrors.ustc.edu.cn/simple/
    

6. 豆瓣(Douban)

  • 网址: http://pypi.douban.com/simple/
  • 命令示例:
    pip install numpy --index-url http://pypi.douban.com/simple/
    

7. 镜像源配置

为了方便长期使用,你可以将pip的默认源设置为国内镜像源。可以通过编辑或创建~/.pip/pip.conf文件(Windows用户为%USERPROFILE%\pip\pip.ini)来配置。

示例配置文件:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

使用方法

假设你想使用清华大学TUNA协会的镜像源,可以按照以下步骤操作:

  1. 创建配置文件

    • 在Linux/Mac下,可以使用以下命令创建或编辑pip.conf文件:
      mkdir -p ~/.pip && tee ~/.pip/pip.conf > /dev/null <<EOF
      [global]
      index-url = https://pypi.tuna.tsinghua.edu.cn/simple[install]
      trusted-host = pypi.tuna.tsinghua.edu.cn
      EOF
      
    • 在Windows下,可以创建或编辑pip.ini文件:
      mkdir %USERPROFILE%\pip
      echo [global] > %USERPROFILE%\pip\pip.ini
      echo index-url = https://pypi.tuna.tsinghua.edu.cn/simple >> %USERPROFILE%\pip\pip.ini
      echo [install] >> %USERPROFILE%\pip\pip.ini
      echo trusted-host = pypi.tuna.tsinghua.edu.cn >> %USERPROFILE%\pip\pip.ini
      
  2. 验证配置

    • 使用pip list检查是否正确配置。
    • 使用pip install numpy测试安装一个库,看看是否从镜像源下载。

通过这些镜像源,你可以显著提升库的下载速度,从而提高开发效率。希望这些信息对你有所帮助!

http://www.lryc.cn/news/469073.html

相关文章:

  • 海外著名新闻门户媒体软文发稿之华盛顿独立报-大舍传媒
  • 青少年编程与数学 02-002 Sql Server 数据库应用 13课题、函数的编写
  • 关于LaTeX的floatrow包导入后标题无法直接放到浮动体上方
  • Flutter Image和Text图文组件实战案例
  • 使用 xlrd 和 xlwt 库进行 Excel 文件操作
  • 03.04、化栈为队
  • Coppelia Sim (v-REP)仿真 机器人3D相机手眼标定与实时视觉追踪 (二)
  • 苏州金龙技术创新赋能旅游新质生产力
  • ceph pg stale 恢复
  • Openlayers高级交互(8/20):选取feature,平移feature
  • uniapp renderjs页面传值
  • AI赋能R-Meta分析核心技术:从热点挖掘到高级模型、助力高效科研与论文发表
  • AMD锐龙8845HS+780M核显 虚拟机安装macOS 15 Sequoia 15.0.1 (2024.10)
  • 当事人单方委托专业机构或个人出具的书面意见,证据效力如何认定?
  • AUTOSAR CP 中 BswM 模块功能与使用介绍(2/2)
  • PCB电路板为什么大多是绿色的
  • Golang | Leetcode Golang题解之第508题出现次数最多的子树元素和
  • 【安全解决方案】深入解析:如何通过CDN获取用户真实IP地址
  • git 免密的方法
  • 如何用 obdiag 排查 OceanBase数据库的卡合并问题——《OceanBase诊断系列》14
  • hackme靶机渗透流程
  • uniapp 常用的地区行业各种多选多选,支持回显,复制粘贴可使用
  • iOS 本地存储地址(位置)
  • uni.showLoading 时禁止点击(防止表单重复提交) 小程序调取微信支付
  • OpenClash与Tailscale冲突得问题
  • day02|计算机网络重难点之HTTP请求报文和响应报文
  • Flutter之build 方法详解
  • 开源呼叫中心系统与商业软件的对比
  • 【人工智能】——matplotlib教程
  • 【c++ gtest】使用谷歌提供的gtest和抖音豆包提供的AI大模型来对代码中的函数进行测试