CondaHTTPError - 安装NLTK时出现SSL错误

时间:2018-02-26 08:11:08

标签: python tensorflow machine-learning anaconda nltk

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

 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机器仍然会抛出错误。我该怎么做才能解决这个问题?

2 个答案:

答案 0 :(得分:1)

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

 channels:
   - defaults
 ssl_verify: False

现在我可以毫无问题地添加这些包装。

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

conda config --set ssl_verify False

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

答案 1 :(得分:1)

您仍然可以通过从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保护中受益。

相关问题