我在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机器仍然显示错误。我该怎么做来解决这个问题?
回答:
你仍然可以通过在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保护的好处了。