Mac python pip 安装 hunspell 报错

Mac python pip 安装 hunspell 报错

错误信息

  1. ld: library not found for -lhunspell
  2. clang: error: linker command failed with exit code 1 (use -v to see invocation)
    hunspell.cpp:20:10: fatal error: ‘hunspell.hxx’ file not found

解决

接下来是个正常安装流程,上面的错误会在下面的某一步解决掉。可以根据自己目前已经进行到哪一步进行调整,不需要一步步严格按照这个步骤来。

  • 第一步
    为系统安装 hunspell
brew install hunspell
  • 第二步
    这一步解决 下面的错误, 注意 软链的版本号
    ld: library not found for -lhunspell clang: error: linker command failed with exit code 1 (use -v to see invocation)
export C_INCLUDE_PATH=/usr/local/include/hunspell
sudo ln -sf /usr/local/lib/libhunspell-1.4.a /usr/local/lib/libhunspell.a #注意版本号
  • 第三步
    解决 下面的错误
    hunspell.cpp:20:10: fatal error: 'hunspell.hxx' file not found
git clone  https://github.com/blatinier/pyhunspell.git
cd pyhunspell
vi setup.py  //修改  main_module_kwargs['include_dirs’] 到个人真实环境的路径

这一步官方github的解释:
For OSX the version of the lib used to compile is hardcoded. If your installation fails, please try to clone the repo and change main_module_kwargs[‘include_dirs’] in setup.py to the correct one and/or open an issue stating the problem and the hunspell version with the .h location in your system.

  • 第四步
python setup.py install

# 安装成功
>>>>
Installed /Users/tal/Workspace/venv/gec/lib/python3.7/site-packages/hunspell-0.5.5-py3.7-macosx-10.14-x86_64.egg
Processing dependencies for hunspell==0.5.5
Finished processing dependencies for hunspell==0.5.5

linux 安装报错

错误信息 : hunspell.hxx: No such file or directory

解决 : sudo apt-get install libhunspell-dev
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值