欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CondaHTTPError: HTTP 000 CONNECTION FAILED for url

程序员文章站 2022-05-31 21:45:35
...

问题描述:
刚开始安装pytorch总是不成功,发现一直出现如下问题:

Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch/repodata.json
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.
ConnectionError(MaxRetryError(“HTTPSConnectionPool(host=‘mirrors.tuna.tsinghua.edu.cn’,
port=443): Max retries exceeded with url:
/anaconda/cloud/msys2/noarch/repodata.json (Caused by
NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object
at 0x7fe41c681358>: Failed to establish a new connection: [Errno -3]
Temporary failure in name resolution’))”))

刚开始以为设置conda源的问题,改了几遍都不行,怀疑是网络设置问题。
然后ping了正常网络,果然不行。

然后进入DNS设置发现里面进入啥都没有,怪不得找不到。于是设置一下DNS就解决问题了。
操作如下:

#编辑resolv.conf
$ sudo vi /etc/resolv.conf

添加内容容下:

nameserver 127.0.1.1
#这里用的是阿里云的DNS服务器
nameserver 223.5.5.5
nameserver 223.6.6.6

解决问题

相关标签: 小工具