【问题标题】:Error installing NLTK in Python 3.4在 Python 3.4 中安装 NLTK 时出错
【发布时间】:2014-06-02 13:15:04
【问题描述】:

我正在过渡到 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()

【问题讨论】:

    标签: nltk python-3.4


    【解决方案1】:

    抱歉,有时它是最明显的工作......

    在这种情况下,只需双击 nltk 文件夹中的 setup.py 文件,就可以让 windows 用 python 执行它,并且安装得很好。

    【讨论】:

    • 我认为它的意思是python setup.py
    • 安装包的正确命令是python setup.py install
    【解决方案2】:

    尝试使用以下命令安装它

    C:\Python34\Scripts\nltk-3.0a4>setup.py 安装

    【讨论】:

    • python setup.py install@Nicolas
    【解决方案3】:

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

    【讨论】:

      【解决方案4】:

      您是否尝试更新 setuptools 包:

      pip3 install --upgrade setuptools
      

      【讨论】:

        猜你喜欢
        • 2017-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-13
        • 1970-01-01
        相关资源
        最近更新 更多