项目场景:
linux中使用conda创建新的虚拟环境失败
问题描述
conda create -n name python=3.X
出现如下错误
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/bioconda/linux-64/current_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.
'https://conda.anaconda.org/bioconda/linux-64'
解决方案:
1.更换镜像
在网上搜索大部分的解决方案都是更换镜像
尝试更换多种镜像源均失败
### 清华镜像源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
### 中科大镜像源
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
### 阿里云镜像源
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main
2. 域名解析
后来发现是域名解析的问题
ping百度的域名ping不通,但ping 百度的ip地址能ping通
ping www.baidu.com
ping: www.baidu.com: Name or service not known
通过更改 /etc/resolv.conf 文件配置
vim /etc/resolv.conf
在文件最后添加
nameserver 8.8.8.8
之后问题就解决了,conda创建新的虚拟环境成功