conda create出现连接问题_[转] conda安装torch出现链接错误

当conda创建环境或安装包时遇到HTTP 000错误,可以尝试使用清华镜像源来解决。步骤包括添加清华的conda镜像源到配置文件,并在必要时删除默认渠道。通过修改~/.condarc文件,将清华镜像源置于最前面,以优化连接速度和稳定性。
摘要由CSDN通过智能技术生成

使用清华镜像,具体方法如下:

问题:conda无法安装更新,报错内容如下:

参考链接:conda httperror http none none for url none Anaconda更新失败

conda create -n tensorflow python=3.5

Fetching package metadata .......

CondaHTTPError: HTTP 000 CONNECTION FAILED for url

Elapsed: -

An HTTP error occurred when trying to retrieve this URL.

HTTP errors are often intermittent, and a simple retry will get you on your way.

ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='nanomirrors.tuna.tsinghua.edu.cn', port=443): Max retries exceded with url: /anaconda/cloud/linux-64/repodata.json (Caused by ConnectTimeoutError(, 'Connection to nanomirrors.tuna.tsinghua.edu.cn timed out. (connct timeout=9.15)'))",),)

1

2

3

4

5

6

7

8

9

解决方法:

#首先先添加清华的镜像源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

#如果无法解决,则删除channels配置文件中部分内容

#具体操作如下:

#1、快速创建channels配置文件的备份(保险起见)

cp ~/.condarc{,.bak}

#查看配置文件的内容

cat ~/.condarc.bak

channels:

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud

- defaults

- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda

- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/conda

- bioconda

- r

- conda-forge

show_channel_urls: true

#2、删除部分内容

## 主要是删除此行: - defaults

#修改后配置文件的内容如下:

vim ~/.condarc

channels:

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

show_channel_urls: true

---------------------

版权声明:本文为CSDN博主「AdaWong_Corner」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/ada0915/article/details/78529877

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值