国内常用镜像地址【附配置方式pip and conda

Pip通用:

Conda通用:

  1. 清华大学镜像

    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
    
  2. 中科大镜像

    https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
    https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
    https://mirrors.ustc.edu.cn/anaconda/cloud/
    https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
    
  3. 阿里镜像

    https://mirrors.aliyun.com/anaconda/pkgs/main/
    https://mirrors.aliyun.com/anaconda/pkgs/free/
    https://mirrors.aliyun.com/anaconda/cloud/
    https://mirrors.aliyun.com/anaconda/cloud/conda-forge/
    

使用方法

PIP:

临时使用

​ 1.单个包:pip install xxxi <index_url>

​ 2.安装包文件列表pip install -r requirements.txt -i <index_url>

备注<index_url>是你想要使用的镜像源的URL,第二个命令指定镜像源下载requirements.txt中的所有插件

永久更改pip的源:

可以执行以下步骤:首先升级pip最新版本然后进行配置。具体操作如下

​ 1.升级pippip install pip -U

​ 2.输入pip config list查看现有镜像源

​ 3.设置pip源:pip config set global.index-url <index_url>

Conda:

临时使用:

​ 1.单个包:conda install —channel <index_url> xxx

例子:conda install —channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ pandas

​ 2.安装包文件列表requirements.txt】:conda不支持

永久更改conda的源:

可以按照以下步骤进行操作

​ 1.输入conda configshow查看当前conda的配置信息channels项为镜像源】

​ 2.输入conda configadd channels <index_url>

例子conda configadd channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

​ 3.输入conda configupdate更新配置文件,使更改生效

​ 4.再次运行conda configshow 命令,确认新的镜像源已经生效

原文地址:https://blog.csdn.net/T752462536/article/details/134003973

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_22658.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注