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

python的pip怎么配置的国内镜像

以下是配置pip国内镜像源的详细方法:

常用国内镜像源列表

  1. 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
  2. 阿里云:https://mirrors.aliyun.com/pypi/simple
  3. 中科大:https://pypi.mirrors.ustc.edu.cn/simple
  4. 华为云:https://repo.huaweicloud.com/repository/pypi/simple
  5. 豆瓣:https://pypi.doubanio.com/simple

Windows系统配置方法(PowerShell)

1. 临时使用镜像源 :

pip install package_name -i https://pypi.tuna.tsinghua.edu.cn/simple

2. 永久配置镜像源 :

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

执行示例:

C:\Users\admin>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Writing to C:\Users\admin\AppData\Roaming\pip\pip.ini

在这里插入图片描述

Writing to ... 表示 pip 已经将新的配置写入到指定的配置文件中。在 Windows 系统中,用户级别的 pip 配置文件路径通常是:
C:\Users\你的用户名\AppData\Roaming\pip\pip.ini
你看到的路径完全正确,说明配置成功生效。

3. 验证配置是否生效 :

pip config list

执行示例:

在这里插入图片描述

C:\Users\admin>pip config list
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'

解决SSL验证问题(需要时)

pip install package_name --trusted-host pypi.tuna.tsinghua.edu.cn

执行示例:

在这里插入图片描述

C:\Users\admin>pip install package_name --trusted-host pypi.tuna.tsinghua.edu.cn
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting package_nameDownloading https://pypi.tuna.tsinghua.edu.cn/packages/61/5f/6690d5f0bad41818063e3f436c101deff0f243adede1d23642deb607349d/package_name-0.1.tar.gz (782 bytes)Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: package_nameBuilding wheel for package_name (pyproject.toml) ... doneCreated wheel for package_name: filename=package_name-0.1-py3-none-any.whl size=1249 sha256=42d4d6c6fdbbb196c2a799d4ad10002437e5ebf1f518623cb353a5af2f09def1Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\82\c3\1b\f14c30dafba2a2afde388a04dac07caef2d1b03e22356314a3
Successfully built package_name
Installing collected packages: package_name
Successfully installed package_name-0.1

常用组合命令示例

pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

requirements.txt文件内容

这里面放着项目需要安装的所有的依赖包;

torch<=2.3.0
torchaudio
modelscope
huggingface
huggingface_hub
funasr>=1.1.3
numpy<=1.26.4
gradio
fastapi>=0.111.1
http://www.lryc.cn/news/2386010.html

相关文章:

  • PCB 通孔是电容性的,但不一定是电容器
  • 领域驱动设计与COLA框架:从理论到实践的落地之路
  • 公有云AWS基础架构与核心服务:从概念到实践
  • Python60日基础学习打卡D35
  • Python经典算法实战
  • spring+tomcat 用户每次发请求,tomcat 站在线程的角度是如何处理用户请求的,spinrg的bean 是共享的吗
  • 目标检测 RT-DETR(2023)详细解读
  • 微信小程序 隐私协议弹窗授权
  • 题目 3325: 蓝桥杯2025年第十六届省赛真题-2025 图形
  • 金众诚业财一体化解决方案如何提升项目盈利能力?
  • bitbar环境搭建(ruby 2.4 + rails 5.0.2)
  • 从零起步搭建基于华为云构建碳排放设备管理系统的产品设计
  • LabVIEW中EtherCAT从站拓扑离线创建及信息查询
  • SpringBoot-11-基于注解和XML方式的SpringBoot应用场景对比
  • Flutter 3.32 新特性
  • 前端面试热门知识点总结
  • windows和mac安装虚拟机-详细教程
  • 【Hive 开发进阶】窗口函数深度解析:OVER/NTILE/RANK 实战案例与行转列高级技巧
  • 在STM32上配置图像处理库
  • 【C++】vector容器实现
  • RocketMQ 深度解析:消息中间件核心原理与实践指南
  • 使用Docker Compose部署Dify
  • 基于 Vue3 与 exceljs 实现自定义导出 Excel 模板
  • 杰发科技AC7840——CSE硬件加密模块使用(1)
  • 前端地图数据格式标准及应用
  • threejs几何体BufferGeometry顶点
  • 向量数据库选型实战指南:Milvus架构深度解析与技术对比
  • java方法重写学习笔记
  • 解决WPF短暂的白色闪烁(白色闪屏)
  • 如何在Java中处理PDF文档(教程)