CondaHTTPError: HTTP 000 CONNECTION FAILED for url

使用conda新建环境变量时,遇到下面的情况

错误输出详细内容

PS D:\Code\PyCode\Python> conda create -n flask python=3

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

解决方案

以win10为例,打开用户文件夹,找到".condarc"文件,打开复制以下内容,保存。

ssl_verify: true
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  # - defaults
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
show_channel_urls: true

重新在命令行输入

PS D:\Code\PyCode\Python> conda create -n flask python=3
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\Program\Anaconda3\envs\flask

  added / updated specs:
    - python=3


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2020.7.22  |                0         125 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    certifi-2020.6.20          |           py38_0         157 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    openssl-1.1.1g             |       he774522_1         4.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pip-20.2.2                 |           py38_0         1.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    python-3.8.5               |       he1778fa_0        15.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    setuptools-49.6.0          |           py38_0         763 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    sqlite-3.33.0              |       h2a8f88b_0         809 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    vc-14.1                    |       h21ff451_1           4 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123
    vs2015_runtime-14.16.27012 |       hf0eaf9b_3         1.2 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    vs2017_runtime-15.4.27004.2010|                1         1.6 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123
    wheel-0.35.1               |             py_0          37 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    wincertstore-0.2           |           py38_0          15 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    zlib-1.2.11                |       h62dcd97_4         113 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:        27.0 MB

The following NEW packages will be INSTALLED:

  ca-certificates    anaconda/pkgs/main/win-64::ca-certificates-2020.7.22-0
  certifi            anaconda/pkgs/main/win-64::certifi-2020.6.20-py38_0
  openssl            anaconda/pkgs/main/win-64::openssl-1.1.1g-he774522_1
  pip                anaconda/pkgs/main/win-64::pip-20.2.2-py38_0
  python             anaconda/pkgs/main/win-64::python-3.8.5-he1778fa_0
  setuptools         anaconda/pkgs/main/win-64::setuptools-49.6.0-py38_0
  sqlite             anaconda/pkgs/main/win-64::sqlite-3.33.0-h2a8f88b_0
  vc                 anaconda/cloud/peterjc123/win-64::vc-14.1-h21ff451_1
  vs2015_runtime     anaconda/pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_3
  vs2017_runtime     anaconda/cloud/peterjc123/win-64::vs2017_runtime-15.4.27004.2010-1
  wheel              anaconda/pkgs/main/noarch::wheel-0.35.1-py_0
  wincertstore       anaconda/pkgs/main/win-64::wincertstore-0.2-py38_0
  zlib               anaconda/pkgs/main/win-64::zlib-1.2.11-h62dcd97_4


Proceed ([y]/n)?

到这里输入y即可完成安装。
(完)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值