机器学习经常使用到python的天然语言处理框架NLTK,这个是机器学习的经常使用包,在使用过程当中会遇到很多问题。我会和你们分享在这其中的一些经验。 html
今天闲来讲一下安装,在安装中出现的download错误。 python
>>> import nltk >>> nltk.download()
NLTK Downloader vim
--------------------------------------------------------------------------- 服务器
d) Download l) List c) Config h) Help q) Quit 框架
--------------------------------------------------------------------------- curl
Downloader> l 机器学习
Packages: svn
Error connecting to server: [Errno -2] Name or service not known 学习
通过推测,是服务器没法链接下载服务器地址致使的。 ui
查看一下nltk download配置
Downloader> c
Data Server:
- URL: <http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml>
- 3 Package Collections Available
- 74 Individual Packages Available
Local Machine:
- Data directory: /home/wym/nltk_data
而后
> curl http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml
报错:curl: (6) Couldn't resolve host 'nltk.googlecode.com'
google的地址确定是被墙掉了(唉,你们懂的)
解决办法:
修改dns地址,
> vim /etc/resolv.conf
修改nameserver为: nameserver 8.8.8.8
问题解决