【问题标题】:Installing nltk for Python 3.4 on Mac OS 10.9在 Mac OS 10.9 上为 Python 3.4 安装 nltk
【发布时间】:2014-08-30 05:34:56
【问题描述】:

我一直试图让 nltk 在 python 3.4 下运行但没有成功。使用http://www.nltk.org/install.html 处的说明:

sudo pip install -U nltk

这适用于 Mac 上预装的 2.7,但是在使用时

sudo pip3 install -U nltk

尝试在 3.4 下安装,我收到以下错误:

    /usr/local/Cellar/python3/3.4.1_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'zip_safe'

  warnings.warn(msg)

/usr/local/Cellar/python3/3.4.1_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'test_suite'

  warnings.warn(msg)

/usr/local/Cellar/python3/3.4.1_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'entry_points'

  warnings.warn(msg)

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: setup.py --help [cmd1 cmd2 ...]

   or: setup.py --help-commands

   or: setup.py cmd --help



error: invalid command 'bdist_egg'

/private/tmp/pip_build_root/nltk/distribute-0.6.21-py3.4.egg

Traceback (most recent call last):

  File "/private/tmp/pip_build_root/nltk/distribute_setup.py", line 143, in use_setuptools

    raise ImportError

ImportError



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/nltk/setup.py", line 23, in <module>

    distribute_setup.use_setuptools()

  File "/private/tmp/pip_build_root/nltk/distribute_setup.py", line 145, in use_setuptools

    return _do_download(version, download_base, to_dir, download_delay)

  File "/private/tmp/pip_build_root/nltk/distribute_setup.py", line 125, in _do_download

    _build_egg(egg, tarball, to_dir)

  File "/private/tmp/pip_build_root/nltk/distribute_setup.py", line 116, in _build_egg

    raise IOError('Could not build the egg.')

OSError: Could not build the egg.

Python 3.4 是用 brew 安装的,bumpy 和 setuptools 都安装正确。我通过一些观察看到了这个问题的提示,但没有明确的答案。

【问题讨论】:

    标签: python macos osx-mavericks nltk python-3.4


    【解决方案1】:

    我刚刚从PyPI 下载了3.0.0b2 .tar.gz 文件,解压后运行

    sudo python3 setup.py install
    

    在解压缩的目录中,一切正常。我在尝试从pip3 安装时遇到了同样的问题。我还应该注意,我将MacPorts 用于 Python 和其他所有内容,但希望这不会产生影响。

    【讨论】:

    • 在进一步思考的同时,我尝试了同样的事情并且它也有效。所以结果是在这种情况下 nltk 文档和 pip 方法看起来被破坏了,但是可以通过手动下载和运行来安装 nltk setup.py
    猜你喜欢
    • 1970-01-01
    • 2013-11-07
    • 2014-05-30
    • 2014-02-12
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    • 2013-11-02
    • 2013-11-11
    相关资源
    最近更新 更多