简体   繁体   English

下载 NLTK 数据时出错:[Errno 11004] getaddrinfo 失败

[英]Error in downloading NLTK data: [Errno 11004] getaddrinfo failed

I have installed NLTK module but when I try to install the data I am getting the error below.我已经安装了 NLTK 模块,但是当我尝试安装数据时,出现以下错误。

在此处输入图片说明

>>>import nltk
>>> nltk.download('punkt')
[nltk_data] Error loading punkt: <urlopen error [Errno 11004]
[nltk_data]     getaddrinfo failed>
False

How should I install the data?我应该如何安装数据?

The issue might be of the Proxy that is setup in the system.问题可能出在系统中设置的代理上。

instead of:而不是:

import nltk导入 nltk

nltk.download() nltk.download()

use:使用:

nltk.set_proxy('SYSTEM PROXY') nltk.set_proxy('系统代理')

nltk.download() nltk.download()

This should solve the problem.这应该可以解决问题。 And to find the proxy of the system: seach proxy in start option of windows.并找到系统的代理:在windows的启动选项中搜索代理。

I understand this is a very old question but wanted to share my experience for anyone who may experience this situation in future.我知道这是一个非常古老的问题,但想与将来可能遇到这种情况的任何人分享我的经验。 What i did was (in windows 10) -我所做的是(在 Windows 10 中)-

  1. open command prompt.打开命令提示符。
  2. set proxies using command -使用命令设置代理 -

set HTTP_PROXY= http://userid:password@proxyurl:port设置 HTTP_PROXY= http://userid:password@proxyurl:port

set HTTPS_PROXY= http://userid:password@proxyurl:port设置 HTTPS_PROXY= http://userid:password@proxyurl:port

set FTP_PROXY= http://userid:password@proxyurl:port设置 FTP_PROXY= http://userid:password@proxyurl:port

  1. run command -运行命令 -

python -m nltk.downloader python -m nltk.downloader

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 URLError: <urlopen error [Errno 11004] getaddrinfo failed> - URLError: <urlopen error [Errno 11004] getaddrinfo failed> gaierror:[Errno 11004] getaddrinfo失败 - gaierror: [Errno 11004] getaddrinfo failed urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed> - urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed> (Python)gaierror:[Errno 11004] getaddrinfo失败 - (Python) gaierror: [Errno 11004] getaddrinfo failed Web2Py IOError:[Errno套接字错误] [Errno 11004] getaddrinfo发送电子邮件失败的错误 - Web2Py IOError: [Errno socket error] [Errno 11004] getaddrinfo failed error for sending email IOError:[Errno套接字错误] [Errno 11004] getaddrinfo尝试打开URL时失败 - IOError: [Errno socket error] [Errno 11004] getaddrinfo failed when I'm trying to open a url 我遇到错误[socket.gaierror:[Errno 11004] getaddrinfo失败] - i am getting error [ socket.gaierror :[Errno 11004] getaddrinfo failed] Python ex_setup.py urlopen错误[Errno 11004] getaddrinfo失败 - Python ex_setup.py urlopen error [Errno 11004] getaddrinfo failed 当我使用virustotal API时,我使用requests.get并得到一个错误[Errno 11004] getaddrinfo failed - When I use the virustotal API, I used requests.get and got an error [Errno 11004] getaddrinfo failed Python HTTPConnectionPool 无法建立新连接:[Errno 11004] getaddrinfo failed - Python HTTPConnectionPool Failed to establish a new connection: [Errno 11004] getaddrinfo failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM