python - 在 Mac OS 10.9 上为 Python 3.4 安装 nltk

标签 python macos osx-mavericks nltk python-3.4

我一直试图让 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 都安装正确。我通过一些 goggling 看到了这个问题的提示,但没有确定的答案。

最佳答案

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

sudo python3 setup.py install

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

关于python - 在 Mac OS 10.9 上为 Python 3.4 安装 nltk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25579374/

相关文章:

python - 在 Python 中丢弃图像时内存泄漏

Python 在多个索引中随机采样

node.js - 如何在 Node.js 中正确清除终端历史记录

macos - 从 Mac OS X Lion 到 Ubuntu 的 NX 键盘映射问题

macos - 是否可以在 macOS 上使用 Amazon AWS iOS 框架?

ruby - phantomjs 客户端使用名称 "Helvetica Neue"调用 CTFontCreateWithName() 并获得带有 PostScript 名称 "HelveticaNeue"的字体

python - Macports 声称 python 是 2.7.6,但是 python --version 说 2.7.5

python - ord ('q' ) 和 0xFF 的用法

macos - Cocoa 文件选择对话框允许的文件类型

python - 将图形旋转至经纬度