SSL 下载 NLTK 数据时出错 [英] SSL error downloading NLTK data

查看:34
本文介绍了SSL 下载 NLTK 数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试下载 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 命令下载了 NLTK:sudo pip3 install -U 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:

无法下载 nltk 数据

我决定发布一个带有屏幕截图的新问题,因为我对其他问题的编辑被拒绝了.

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:

NLTK 下载 SSL:证书验证失败

使用 nltk.download() 下载错误

推荐答案

如果您运行以下终端命令,则无需禁用 SSL 检查:

You don't need to disable SSL checking if you run the following terminal command:

/Applications/Python 3.6/Install Certificates.command

3.6 的位置,如果它是较早的版本,请放置您的 Python 版本.然后你应该能够打开你的 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 数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆