機器學習之nltk download出錯:Error connecting to server...

機器學習經常使用到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

問題解決

相關文章
相關標籤/搜索