问题描述
我尝试在 Windows 64 位机器上从源代码和通过 pip 安装 mecab-python-windows 包。在这两种情况下,我都会收到以下错误:
MeCab_wrap.cxx(3137): Fatal error C1083: Cannot open include file: 'mecab.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' Failed with exit status 2`
我该如何处理这个错误?我在哪里可以找到 mecab.h 文件,我应该把它放在哪里?我真的很感激任何建议!谢谢!
解决方法
mecab-python-windows
未维护,开发已转移到 PyPI 上的 mecab
。请参阅 here,其中还提到了您遇到的错误。它建议您这样做:
CPLUS_INCLUDE_PATH=`python-config --prefix`/Headers:$CPLUS_INCLUDE_PATH pip install mecab
我建议你使用 mecab-python3。