python的pip配置的国内镜像的实现

Written by

in

文章目录
  • 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:https://mirrors.aliyun.com/pypi/simple 中科大:https://pypi.mirrors.ustc.edu.cn/simple 华为云:https://repo.huaweicloud.com/repository/pypi/simple 豆瓣:https://pypi.doubanio.com/simple
  • pip install package_name –trusted-host pypi.tuna.tsinghua.edu.cn
  • pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple –trusted-host mirrors.aliyun.com
  • 目录
    • 常用国内镜像源列表
    • Windows系统配置方法(PowerShell)
      • 1. 临时使用镜像源 :
      • 2. 永久配置镜像源 :
      • 执行示例:
      • 3. 验证配置是否生效 :
      • 执行示例:
    • 解决SSL验证问题(需要时)
      • 执行示例:
    • 常用组合命令示例
      • requirements.txt文件内容

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

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

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

    C:Usersadmin>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    Writing to C:UsersadminAppDataRoamingpippip.ini
    

    在这里插入图片描述

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

    pip config list
    

    在这里插入图片描述

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

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

    在这里插入图片描述

    C:Usersadmin>pip install package_name --trusted-host pypi.tuna.tsinghua.edu.cn
    Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
    Collecting package_name
      Downloading https://pypi.tuna.tsinghua.edu.cn/packages/61/5f/6690d5f0bad41818063e3f436c101deff0f243adede1d23642deb607349d/package_name-0.1.tar.gz (782 bytes)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: package_name
      Building wheel for package_name (pyproject.toml) ... done
      Created wheel for package_name: filename=package_name-0.1-py3-none-any.whl size=1249 sha256=42d4d6c6fdbbb196c2a799d4ad10002437e5ebf1f518623cb353a5af2f09def1
      Stored in directory: c:usersadminappdatalocalpipcachewheels82c31bf14c30dafba2a2afde388a04dac07caef2d1b03e22356314a3
    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
    

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

    torch<=2.3.0
    torchaudio
    modelscope
    huggingface
    huggingface_hub
    funasr>=1.1.3
    numpy<=1.26.4
    gradio
    fastapi>=0.111.1

    到此这篇关于python的pip配置的国内镜像的实现的文章就介绍到这了,更多相关python pip配置国内镜像内容请搜索风君子博客以前的文章或继续浏览下面的相关文章希望大家以后多多支持风君子博客! 

    您可能感兴趣的文章:

    • 如何给pip更换国内源并配置Python的国内镜像详解
    • python pip配置国内镜像源的方法(永久和临时)
    • Python使用国内镜像加速pip安装的方法讲解
    • Python-pip配置国内镜像源快速下载包的方法详解
    • Python-pip配置国内镜像源的安装方式
    • Python配置pip国内镜像源的实现
    • 基于Python pip用国内镜像下载的方法

    站内搜索