>> import MeCab Traceback (most recent cal-6ren">
gpt4 book ai didi

python - Mac 10.8.3 MeCab Python "Symbol Not found"错误

转载 作者:太空宇宙 更新时间:2023-11-03 18:59:02 25 4
gpt4 key购买 nike

我安装了“https://code.google.com/p/mecab/downloads/list”。

还有

>>> import MeCab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/test/lib/python2.7/site-packages/MeCab.py", line 26, in <module>
_MeCab = swig_import_helper()
File "/Users/test/lib/python2.7/site-packages/MeCab.py", line 22, in swig_import_helper
_mod = imp.load_module('_MeCab', fp, pathname, description)
ImportError: dlopen(/Users/test/lib/python2.7/site-packages/_MeCab.so, 2): Symbol not found: __ZN5MeCab11createModelEPKc
Referenced from: /Users/test/lib/python2.7/site-packages/_MeCab.so
Expected in: dynamic lookup

也许 RUBY 用户也有同样的错误。 http://www.sssg.org/blogs/naoya/archives/2183

但我不认识 RUBY。所以我不明白他们的固定解决方案。

请帮帮我~!

最佳答案

当我尝试在 Mac OS X (Yosemite) 上使用 python3 运行最新的 mecab-python-0.996 时,出现了同样的错误。但多亏了以下页面,通过重新构建库,我可以在应用程序中成功执行“导入 MeCab”(但在命令行上运行“python3 -c“导入 MeCab””时仍然出现相同的错误)。

http://ksmzn.hatenablog.com/entry/mecab-python3 http://d.hatena.ne.jp/yassuo_s/20110403/1301809955

$ wget https://mecab.googlecode.com/files/mecab-python-0.996.tar.gz

$ cd mecab-python-0.996

$ vi setup.py(对于python3,按如下方式更改cmd2)

def cmd2(str):  
return cmd1(str).split()

$ ls ./build

lib.macosx-10.6-intel-2.7   temp.macosx-10.6-intel-2.7

$ python3 setup.py 构建

$ ls ./build

lib.macosx-10.10-x86_64-3.4 lib.macosx-10.6-intel-2.7   temp.macosx-10.10-x86_64-3.4    temp.macosx-10.6-intel-2.7

$ sudo python3 setup.py install

关于python - Mac 10.8.3 MeCab Python "Symbol Not found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16505764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com