CondaHTTPError: HTTP 000 CONNECTION FAILED for url

该博客为《Ubuntu 相关》系列博客的第七篇,该系列博客主要对Ubuntu安装各种软件或者库进行一个记录,方便重装系统后快速恢复工作。

在学习大数定理和中心极限定理时,发现几个程序,但是运行不了,anaconda没有安装matplotlib,所以想安装一下,结果出来现了“CondaHTTPError: HTTP 000 CONNECTION FAILED for url”,记录一下解决过程,因为硬盘就到,要重装ubuntu了,O(∩_∩)O~~。

CondaHTTPError: HTTP 000 CONNECTION FAILED for url

  • 报错情况
  • 解决方案

报错情况

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/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.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

'https://repo.anaconda.com/pkgs/main/linux-64'

CondaHTTPError: HTTP 000 CONNECTION FAILED for url_第1张图片

解决方案

#首先先添加清华的镜像源
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

CondaHTTPError: HTTP 000 CONNECTION FAILED for url_第2张图片
CondaHTTPError: HTTP 000 CONNECTION FAILED for url_第3张图片
CondaHTTPError: HTTP 000 CONNECTION FAILED for url_第4张图片

CondaHTTPError: HTTP 000 CONNECTION FAILED for url_第5张图片

参考博客:
https://blog.csdn.net/ada0915/article/details/78529877?ticket=ST-57905-PDZCg53W9GQSf2zFlnCX-passport.csdn.net

你可能感兴趣的:(Ubuntu,ubuntu,linux)