安装hunspell包

时间:2017-05-03 09:41:36

标签: python centos7 hunspell

我期待使用pip安装hunspell软件包,但它会抛出以下错误:

Collecting hunspell
  Using cached hunspell-0.4.1.tar.gz
Building wheels for collected packages: hunspell
  Running setup.py bdist_wheel for hunspell ... error
  Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmphqvqt4lxpip-wheel- --python-tag cp34:
  /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'hunspell' extension
  creating build
  creating build/temp.linux-x86_64-3.4
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
  hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
   #include <hunspell.h>
                        ^
  compilation terminée.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
    Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-euhsmasb-record/install-record.txt --single-version-externally-managed --compile:
    /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'hunspell' extension
    creating build
    creating build/temp.linux-x86_64-3.4
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
    hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
     #include <hunspell.h>
                          ^
    compilation terminée.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-euhsmasb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-oyfpp3iy/hunspell/
[root@localhost Bureau]# alias python-devel=python34-devel
[root@localhost Bureau]# pip install hunspell
Collecting hunspell
  Using cached hunspell-0.4.1.tar.gz
Building wheels for collected packages: hunspell
  Running setup.py bdist_wheel for hunspell ... error
  Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmptwg_9c8vpip-wheel- --python-tag cp34:
  /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'hunspell' extension
  creating build
  creating build/temp.linux-x86_64-3.4
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
  hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
   #include <hunspell.h>
                        ^
  compilation terminée.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
    Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zrlp2go9-record/install-record.txt --single-version-externally-managed --compile:
    /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'hunspell' extension
    creating build
    creating build/temp.linux-x86_64-3.4
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
    hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
     #include <hunspell.h>
                          ^
    compilation terminée.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zrlp2go9-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-xpljhkom/hunspell/

我听说安装python3-dev会解决问题。 我尝试没有成功。 我在CentOS 7下使用python 3.4。 我能得到一些帮助吗?提前谢谢。

3 个答案:

答案 0 :(得分:6)

我刚刚在Centos7 64位上使用python3.4和pip3.4进行了此操作。 (注意,你需要python3.4和pip3.4)

我最终通过pip3.4开始工作,但在此工作之前,我不得不采取一些额外的步骤。我采取的步骤是:

安装python3.4开发头文件:

sudo yum install python34u-devel.x86_64

安装hunspell和hunspell-devel(hunspell.h和hunspell lib需要):

sudo yum install hunspell hunspell-devel

在/ usr / lib64 /中,为hunspell库添加一个额外的符号链接:

sudo ln -s libhunspell-1.3.so libhunspell.so

最后,运行命令:

sudo pip3.4 install hunspell

...这给了我以下输出:

... (compiler output deleted) ...
Successfully built hunspell
Installing collected packages: hunspell
Successfully installed hunspell-0.4.1

答案 1 :(得分:2)

OP解决方案。

我想通了,我会在这里分享这个方法,它可能有帮助:) 首先你需要安装python-devel和

yum install python-devel  
yum install hunspell-devel  

然后更正了符号链接

cd /usr/lib64
sudo ln -s libhunspell-1.3.so.0.0.0 libhunspell.so
ls -l | grep hunspell

祝你好运:)

答案 2 :(得分:1)

尝试一下:

sudo apt install python-dev libhunspell-dev
pip install hunspell