在 Windows 上安装 python 库的问题:CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/anaconda/win-64

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50125472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:24:11  来源:igfitidea点击:

Issues with installing python libraries on Windows : CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/anaconda/win-64

pythonsslhttpsanacondaconda

提问by Peter Lucas

Morning All,

大家早,

I'd like to install the pymongo library but am getting the following error:

我想安装 pymongo 库,但出现以下错误:

    (C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
    conda install -c anaconda pymongo

    Fetching package metadata ...
    CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a
    naconda/win-64/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.

    ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', por
    t=443): Max retries exceeded with url: /anaconda/win-64/repodata.json (Caused by
     ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000
    00000054D6128>, 'Connection to conda.anaconda.org timed out. (connect timeout=9.
    15)'))",),)

Steps taken to resolve:

解决的步骤:

1. Update C:\Users\xxxxxxx\.condarc file with the following:

channels:
  - defaults
ssl_verify: false
proxy_servers:
http: http://sproxy.fg.xxx.com:1000
https: https://sproxy.fg.xxx.com:1000

2. (C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
    conda config --set ssl_verify False

Additional Info

附加信息

(C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
conda info

Current conda install:

               platform : win-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : 3.0.22
         python version : 3.6.2.final.0
       requests version : 2.18.4
            config file : C:\Users\xxxxxxx\.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.18.4 CPython/3.6.2 Windows/7 W
indows/6.1.7601
          administrator : False

A number of posts online simply reinstalled Anaconda,any other options apart from a fresh install?

许多在线帖子只是重新安装了Anaconda,除了全新安装之外还有其他选择吗?

回答by talentcat

I try to create a virtual env with python 2.7 with anaconda, the base env is python 3.7. I encounter the exactly same problem. It turns out that there isn't such problem with other virtual envs with python 3.7 or 3.6.

我尝试使用带有 anaconda 的 python 2.7 创建一个虚拟环境,基础环境是 python 3.7。我遇到了完全相同的问题。事实证明,使用 python 3.7 或 3.6 的其他虚拟环境没有这样的问题。

This postworks perfectly to solve my problem on win7 with anaconda prompt. It basically says you need to add the following directories into your user environment path in windows:

这篇文章完美地解决了我在 anaconda 提示符下在 win7 上的问题。它基本上是说您需要将以下目录添加到 Windows 中的用户环境路径中:

C:\your_directory_to_anaconda3\Anaconda3\Scripts

C:\your_directory_to_anaconda3\Anaconda3\Scripts

C:\your_directory_to_anaconda3\Anaconda3\

C:\your_directory_to_anaconda3\Anaconda3\

C:\your_directory_to_anaconda3\Anaconda3\Library\bin -- This is the directory for openssl

C:\your_directory_to_anaconda3\Anaconda3\Library\bin -- 这是openssl的目录

回答by kamal dua

Execute the following command in the cmd prompt/terminal:

在 cmd 提示符/终端中执行以下命令:

conda config --set ssl_verify no

conda config --set ssl_verify no

回答by andiwi

If you added conda to your PATH variables, remove it and use the "Anaconda Prompt". This solved the problem for me.

如果您将 conda 添加到 PATH 变量中,请将其删除并使用“Anaconda Prompt”。这为我解决了这个问题。

See: https://github.com/conda/conda/issues/8046#issuecomment-450582208

参见:https: //github.com/conda/conda/issues/8046#issuecomment-450582208

回答by Mehmet Ali Meram

I had the same problem on Windows 10-64 bit and intuitively installed the 64-bit version of miniconda. However, it results in exactly the same error above. Installing 32 bit conda installer has resolved the issue

我在 Windows 10-64 位上遇到了同样的问题,并且直观地安装了 64 位版本的 miniconda。但是,它会导致与上述完全相同的错误。安装 32 位 conda 安装程序已解决该问题

回答by Max Benelhadj

My authenticated proxy server is configured with a domain whitelist for massive and repeated downloads so root or local sudoer doesn't need to be authenticated. Adding conda.anaconda.org is not enough as this repo redirect its traffic to amazonaws.com. In my case, adding ".amazonaws.com" to the whitelist solved the issue.

我的经过身份验证的代理服务器配置了一个域白名单,用于大量重复下载,因此不需要对 root 或本地 sudoer 进行身份验证。添加 conda.anaconda.org 是不够的,因为此 repo 将其流量重定向到 amazonaws.com。就我而言,将“.amazonaws.com”添加到白名单解决了这个问题。

回答by Sameer Kumar Choudhary

I also had the Same Issue, I resolved by installing 32 bit Anaconda Installer. Which resolved the CondaHTTPError: HTTP 000 CONNECTION, on Windows 64 bit.

我也有同样的问题,我通过安装 32 位 Anaconda 安装程序解决了。在 Windows 64 位上解决了 CondaHTTPError: HTTP 000 CONNECTION。

回答by Michael Heidelberg

Before installing some package (pydicom) the installation run just fine. After it I tried to install matplotlib, but I got the same error as yours.

在安装一些包 ( pydicom)之前,安装运行得很好。之后我尝试安装matplotlib,但我遇到了和你一样的错误。

I tried conda config --set ssl_verify nobut it didn't solve the problem so I set it again to true.

我试过了,conda config --set ssl_verify no但没有解决问题,所以我再次将其设置为 true。

Fortunately, I had a virtual environment where I installed my packages. I closed all Anaconda prompts and tried in a new testenvironment. Magically, the install worked. I came back to my original virtual env and run the install again, and it worked!.

幸运的是,我有一个安装包的虚拟环境。我关闭了所有 Anaconda 提示并在新test环境中尝试。神奇的是,安装成功了。我回到我原来的虚拟环境并再次运行安装,它成功了!。

It might be that I just had to wait for some time before I could use conda installagain.

可能是我只需要等待一段时间才能conda install再次使用。

One other thing I could do is remove the package that caused the problem, but I didn't have the chance to try it. If it has anything to do with some virtual environments not being affected, then one possible way to guard against this is to clone the environment before installing any new package.

我可以做的另一件事是删除导致问题的包,但我没有机会尝试。如果它与一些不受影响的虚拟环境有关,那么防止这种情况的一种可能方法是在安装任何新软件包之前克隆环境。

Edit: I tried the same solution but It did not work. But instead of showing the error immediately, it asks me whether I want to proceed. I deactivated the env, and re-opened anaconda prompt, then did the same steps as above and worked again.

编辑:我尝试了相同的解决方案,但没有奏效。但是它没有立即显示错误,而是询问我是否要继续。我停用了 env,并重新打开 anaconda 提示符,然后执行与上述相同的步骤并再次工作。

回答by Peter Lucas

The issue was resolved by adding a username and password to file C:\Users\xxxxx.condarc

通过将用户名和密码添加到文件 C:\Users\xxxxx.condarc 解决了该问题

channels:
  - defaults
ssl_verify: false
proxy_servers:
  http: http://xxxxx:[email protected]:yyyy
  https: https://xxxxx:[email protected]:yyyy

回答by Victor Ochieng'

Came across the CondaHTTP Connection error after installing Anaconda environment on a new Windows 10 computer. I tried virtually all the recommendations above unsuccessfully! Looking up the Anaconda archives ( https://repo.continuum.io/archive/), I downloaded the immediate previous release .... and on installation and rebooting my PC, all is now wellscreenshot of release

在新的 Windows 10 计算机上安装 Anaconda 环境后遇到 CondaHTTP 连接错误。我几乎尝试了上面所有的建议都没有成功!查找 Anaconda 档案(https://repo.continuum.io/archive/),我下载了之前的版本......并在安装和重新启动我的电脑时,现在一切都是发布的截图

回答by Neeraj

I faced this issues after "conda clean -a" on win-64.
Activating and deactivating existing conda env resolved the issue.

我在 win-64 上的“conda clean -a”之后遇到了这个问题。
激活和停用现有的 conda env 解决了该问题。