无法安装NLTK - UrlLib2错误

时间:2014-02-16 10:26:06

标签: ubuntu installation urllib2 nltk

我已经在一台机器上安装了NLTK(一年前做过)。现在我正在尝试在我从实验室的一般集群中获得的VM中安装NLTK。已经安装了Numpy。 Pip也在那里......现在我尝试使用:

安装它
root@jupiter31:~/FSD# sudo pip install nltk

它出错了: -

Downloading/unpacking nltk
  Downloading nltk-2.0.4.tar.gz (955kB): 955kB downloaded
  Running setup.py (path:/tmp/pip_build_root/nltk/setup.py) egg_info for package nltk
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/nltk/setup.py", line 23, in <module>
        distribute_setup.use_setuptools()
      File "distribute_setup.py", line 145, in use_setuptools
        return _do_download(version, download_base, to_dir, download_delay)
      File "distribute_setup.py", line 124, in _do_download
        to_dir, download_delay)
      File "distribute_setup.py", line 193, in download_setuptools
        src = urlopen(url)
      File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
        return _opener.open(url, data, timeout)
      File "/usr/lib/python2.7/urllib2.py", line 400, in open
        response = self._open(req, data)
      File "/usr/lib/python2.7/urllib2.py", line 418, in _open
        '_open', req)
      File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
        return self.do_open(httplib.HTTPConnection, req)
      File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
        raise URLError(err)
    urllib2.URLError: <urlopen error [Errno 111] Connection refused>
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz

Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/tmp/pip_build_root/nltk/setup.py", line 23, in <module>
    distribute_setup.use_setuptools()
  File "distribute_setup.py", line 145, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "distribute_setup.py", line 124, in _do_download
    to_dir, download_delay)
  File "distribute_setup.py", line 193, in download_setuptools
    src = urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/nltk

不确定如何继续。我编写了export http proxy命令来查看它是否是代理问题。仍然给出同样的错误。

这是来自服务器端的临时错误还是我做错了什么?

1 个答案:

答案 0 :(得分:1)

我在尝试安装nltk时遇到同样的错误,除了Connection refused而不是<urlopen error [Errno 113] No route to host>我收到错误sudo pip install --proxy="myproxy:port" nltk

您是否尝试过使用以下语法?

{{1}}