问题描述
我正在尝试下载NLTK 3.0,以便在Mac OS X 10.7.5上与Python 3.6一起使用,但出现SSL错误:
I am trying to download NLTK 3.0 for use with Python 3.6 on Mac OS X 10.7.5, but am getting an SSL error:
import nltk
nltk.download()
我使用pip3命令:sudo pip3 install -U nltk
下载了NLTK.
I downloaded NLTK with a pip3 command: sudo pip3 install -U nltk
.
在NLTK下载器中更改索引可以使下载器显示所有NLTK的文件,但是当一个人尝试下载所有文件时,会出现另一个SSL错误(请参见照片底部):
Changing the index in the NLTK downloader allows the downloader to show all of NLTK's files, but when one tries to download all, one gets another SSL error (see bottom of photo):
我对计算机科学比较陌生,对SSL一点也不懂.
I am relatively new to computer science and am not at all savvy with respect to SSL.
我的问题是如何简单地解决此问题?
My question is how to simply resolve this issue?
这是一个存在相同问题的用户的类似问题:
Here is a similar question by a user who is having the same problem:
我决定发布一个带有屏幕截图的新问题,因为对其他问题的编辑被拒绝了.
I decided to post a new question with screenshots, since my edit to that other question was rejected.
我认为没有帮助的类似问题
Similar questions which I did not find helpful:
推荐答案
如果运行以下终端命令,则无需禁用SSL检查:
You don't need to disable SSL checking if you run the following terminal command:
/Applications/Python 3.6/Install Certificates.command
如果您的Python版本较早,请代替3.6
.然后,您应该能够打开Python解释器(使用命令python3
)并在那里成功运行nltk.download()
.
In the place of 3.6
, put your version of Python if it's an earlier one. Then you should be able to open your Python interpreter (using the command python3
) and successfully run nltk.download()
there.
这是一个问题,其中urllib
使用系统证书存储中未包含的OpenSSL嵌入式版本. 这是一个答案,其中包含正在发生的事情的更多信息.
This is an issue wherein urllib
uses an embedded version of OpenSSL that not in the system certificate store. Here's an answer with more information on what's going on.
这篇关于SSL错误下载NLTK数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!