在Python 3.4中安装NLTK时出错

时间:2014-06-02 13:15:04

标签: nltk python-3.4

我正在转换到python 3.4并尝试安装NLTK。 Pyyaml和numpy也安装了,setuptools和pip - 所有这些都是最新版本的Win 7 64bit。 但是,无论我如何安装它,NLTK都会让我感到困惑。这是我上次尝试的cmd输出。顺便说一下,没有以任何方式改变文件;)

有谁知道我能做些什么来让NLTK启动并运行?

C:\Python34\Scripts\nltk-3.0a4>python setup.py install
running install
Traceback (most recent call last):
  File "setup.py", line 81, in <module>  
    zip_safe=True, # since normal files will be present too?
  File "C:\Python34\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Python34\lib\site-packages\setuptools\command\install.py", line 65, i
n run
    self.do_egg_install()
  File "C:\Python34\lib\site-packages\setuptools\command\install.py", line 101,
in do_egg_install
    cmd.ensure_finalized()  # finalize before bdist_egg munges install cmd
  File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "C:\Python34\lib\site-packages\setuptools\command\easy_install.py", line
304, in finalize_options
    self.index_url, search_path = self.shadow_path, hosts=hosts,
  File "C:\Python34\lib\site-packages\setuptools\package_index.py", line 269, in
 __init__
    Environment.__init__(self,*args,**kw)
  File "C:\Python34\lib\site-packages\pkg_resources.py", line 799, in __init__
    self.scan(search_path)
  File "C:\Python34\lib\site-packages\pkg_resources.py", line 829, in scan
    self.add(dist)
  File "C:\Python34\lib\site-packages\pkg_resources.py", line 849, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: str() < NoneType()

4 个答案:

答案 0 :(得分:1)

抱歉,有时候最明显的事情就是......

在这种情况下,只需双击nltk文件夹中的setup.py文件,允许windows使用python执行它并安装得很漂亮。

答案 1 :(得分:0)

尝试使用以下命令安装它

  
    
      

C:\ Python34 \ Scripts \ nltk-3.0a4&gt; setup.py install

    
  

答案 2 :(得分:0)

打开命令提示符(以管理员身份运行)。使用cd导航到下载的nltk软件包所在的文件夹。然后运行命令python setup.py install。就是这样。

答案 3 :(得分:0)

您是否尝试更新setuptools软件包:

pip3 install --upgrade setuptools