MAC中CondaHTTPError: HTTP 000 CONNECTION FAILED for url

文章目录

  • 问题
  • 原因
  • 解决

问题

mac中在安装虚拟环境 conda create --name tensorflow1.4python3.6 python=3.6 时,出现以下问题

=================
xxx ~ % conda create --name tensorflow1.4python3.6 python=3.6
Collecting package metadata (current_repodata.json): failed

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

===================

原因

下载的通道选择出错,导致访问anaconda的网址慢,从而访问失败。
可查看所有可选择的通道,命令:conda config --show-sources,出现以下提示
> /Users/xx/.condarc <
ssl_verify: True
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/
  • defaults
    show_channel_urls: True
    可以看到,这里有三个通道,可能是访问其中一个通道出错了。

解决

删掉其他所有通道,保留第一个通道
(1)打开 .condarc 文件,命令:open .condarc
将上述内容改为
ssl_verify: True
channels:

  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    show_channel_urls: True
    保存文件

你可能感兴趣的:(问题)