Home >Backend Development >Python Tutorial >nltk download出错Error connecting to server
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