CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pk gs/r/win-64/repodata.json.bz2>

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pk gs/r/win-64/repodata.json.bz2>

我需要安装 Tensorflow 并试图先添加环境。但是我收到 HTTP Connection Failed 错误。我支持公司代理,并且已经在 .condarc 文件中很好地定义了它们。这是我收到的错误:

C:\Users\Rahul\Downloads>conda create -n tensorflow python=3.6 anaconda
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url 
<https://repo.continuum.io/pk
gs/r/win-64/repodata.json.bz2>
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.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io, por
t=443): Max retries exceeded with url: /pkgs/r/win-64/repodata.json.bz2 (Caused
by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0
000001A00393C88>: Failed to establish a new connection: [Errno 11002] getaddrinf
o failed',))",),)

我在他们的问题跟踪器中详细发布了这个问题: https://github.com/conda/conda/issues/7283

如问题跟踪器中所述,我已经尝试过重置 ssl、添加 condarc 文件等。但到目前为止还没有成功。我的代理按预期工作并且我在 condarc 文件中的条目是正确的。也可以通过浏览器毫无问题地访问 continuum 存储库。

None 等命令 conda updateconda install 有效并在执行时给出相同的错误堆栈。

这里可能出了什么问题?

我发现通过命令行调用可信主机已停止,因此我在 pip.ini 文件中添加了相同的内容。之后就成功了!

Apparently, the condarc file was updated and rewritten as an empty file while I ran config command. I tried running proxy settings and trusted host through command line, but it doesn't work. But then found that invoking trusted host through command line is discontinued and so I added the same in pip.ini file. After that it worked!

就像我在 GitHub issue tracker 中提到的那样,我在 pip.ini 中添加了下面的内容并且有效

trusted-host = pypi.python.org pypi.org files.pythonhosted.org

使用 Anaconda 自己的命令提示符而不是 windows 并输入以下命令。无需弄乱 pip.ini 文件

conda create -n yourenvname python=x.x

我在 Windows 10 台机器上遇到了同样的问题,下面的解决方案有帮助 在环境变量中添加以下路径:

  1. Anaconda3\Library\bin

  2. Anaconda3

  3. Anaconda3\Scripts

强烈推荐复制libcrypto-1_1-x64。* libssl-1_1-x64.* 从 Anaconda 文件夹中的 .\Library 到 Anaconda 文件夹中的 .\DLL。我 100% 确定您的问题将得到解决。请不要在所有平台上寻找解决方案。

我更新了 .condarc 文件

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

在 windows 10 台机器上:

  1. 导航到“环境变量”- 如何导航到 [environment_variables][1]
  2. 点击“路径”
  3. 单击“新建”并复制并添加以下路径:
  4. "C:\Users\yourusername\Anaconda3"
  5. "C:\Users\yourusername\Anaconda3\Scripts"
  6. "C:\Users\yourusername\Anaconda3\图书馆\bin"

CondaHTTPError: HTTP 000 连接失败

这个错误我也经常遇到。 我尝试了其他解决方案,例如

conda config --set ssl_verify no 但没有修复,最后我想通了!

只需打开 Anaconda 提示符而不是 CMD 并在那里键入所有命令,它将解决您的问题!

左(Anaconda 提示符)右(Windows CMD)

将提到的 conda 路径添加到 windows 路径(它们丢失了)并没有解决我的问题,也没有使用 conda 提示符。事实上,在conda提示中,我注意到另一个问题:“系统找不到指定的路径”,就在启动提示时。然后我在 conda 提示符中 运行 “conda init”,这显然解决了问题。 (可能与之前添加的路径相结合。)

您成功地从 conda 提示创建了一个新环境,而不是从 cmd,因为您的 shell 尚未初始化。

  1. 运行 conda init cmd.exe 初始化cmd.
  2. 重新打开您的 cmd shell(必须)。
  3. 测试 conda activateconda create 命令应该能正常工作。