【问题标题】:CondaHTTPError - SSL error while installing NLTKCondaHTTPError - 安装 NLTK 时出现 SSL 错误
【发布时间】:2018-08-05 15:26:48
【问题描述】:

我正在尝试在 Anaconda 的 tensorflow 环境中安装 NLTK。我为我的 Windows 7 电脑使用了命令“conda install nltk”。它给出了以下错误:

 CondaHTTPError: HTTP 000 CONNECTION FAILED for url
 <https://repo.continuum.io/pkgs/r/win-32/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.

 SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.continuum.io\', port=443): Max retries exceeded with url: /pkgs/r/win-32/repodata.json.bz2 (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')],)",),))',),)

我的系统中有一个额外的证书。所以我将证书哈希添加到 anaconda/ssl 的 cert.pem 文件中。它适用于Linux机器,但Windows机器仍然抛出错误。我该怎么做才能解决这个问题?

【问题讨论】:

    标签: python tensorflow machine-learning anaconda nltk


    【解决方案1】:

    我找到了解决方案。我修改了 .condarc 文件并将 ssl_verify 属性设置为 False。它看起来像这样:

     channels:
       - defaults
     ssl_verify: False
    

    现在我可以毫无问题地添加那些打包的。

    另一种方法是从命令行修改配置文件:

    conda config --set ssl_verify False
    

    这将为您编辑文件,无论它位于何处。

    【讨论】:

    • 这不是一个解决方案,而是一个额外的问题(在这种情况下是安全性)
    【解决方案2】:

    您仍然可以通过从 Windows 机器上的浏览器导出 CA 证书来使用 ssl。

    http://docs.bvstools.com/home/ssl-documentation/exporting-certificate-authorities-cas-from-a-website

    将证书保存到您可以访问的文件夹中,然后只需将 .condarc 文件中的 ssl_verify 值设置为证书的位置。

    ssl_verify: C:\\conda_config\\certificates\\ca_cert.cer
    

    这将使您可以很容易地从 ssl 保护中受益。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-13
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 1970-01-01
      • 2020-05-15
      • 2021-09-13
      • 2023-04-11
      相关资源
      最近更新 更多