安装 NLTK 时出错

安装 NLTK 时出错

我按照此链接中给出的步骤安装 NLTKhttp://www.bogotobogo.com/python/NLTK/NLTK_install.php.但是运行以下命令时出现错误 sudo pip install -U numpy

输出(最后一部分):

    out = check_types(*a, **kw)

  File "numpy/core/setup.py", line 293, in check_types

    "Cannot compile 'Python.h'. Perhaps you need to "\

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-lYs_os/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Vu1Dyw-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lYs_os/numpy

请帮忙做一下?还有其他方法吗?!

答案1

尝试python-dev按照错误提示进行安装:

sudo apt-get install python-dev

python-devel适用于基于 RHEL 的系统和python-dev基于 Debian 的系统。

相关内容