Home  >  Article  >  Backend Development  >  nltk download出错Error connecting to server

nltk download出错Error connecting to server

高洛峰
高洛峰Original
2016-10-18 10:14:193951browse

Machine learning often uses python’s natural language processing framework NLTK. This is a commonly used package for machine learning. You will encounter many problems during use. I will share with you some of my experiences in this.

Today, let’s talk about the installation and the download error that occurred during the installation.


>>> import nltk

>>> nltk.download()

NLTK Downloader

-------------------------- -------------------------------------------------- -

d) Download l) List c) Config h) Help q) Quit

-------------------------------- ------------------------------------------------

Downloader> l

Packages:

Error connecting to server: [Errno -2] Name or service not known

After speculation, it is caused by the server being unable to connect to the download server address.

Check the nltk download configuration

Downloader> c

Data Server:

- URL:

- 3 Package Collections Available

- 74 Individual Packages Available

Local Machine:

- Data directory: /home /wym/nltk_data

Then

> curl http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml

Error: curl: (6) Couldn't resolve host 'nltk.googlecode.com '

Google's address must have been blocked (alas, everyone knows)

Solution:

Modify the dns address,

> vim /etc/resolv.conf

Modify the nameserver to: nameserver 8.8.8.8

Problem Solved


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn