在Mac OS 10.9上安装适用于Python 3.4的nltk

ORG*_*ORG 6 python macos nltk osx-mavericks 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.
Run Code Online (Sandbox Code Playgroud)

Python 3.4使用brew安装,并且正确安装了bumpy和setuptools.我通过一些令人难以置信的但没有明确的答案看到了这个问题的暗示.

Mat*_*DMo 8

我刚刚.tar.gzPyPI下载了3.0.0b2 文件,解压缩并运行

sudo python3 setup.py install
Run Code Online (Sandbox Code Playgroud)

在解压缩的目录中,一切正常.我有同样的问题试图安装pip3.我还应该注意到我使用MacPorts进行Python以及其他所有操作,但希望这不会产生任何影响.