我已经成功安装了mecab-python3,但是导入时出现错误。
!import mecab
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-32-71af23e59d14> in <module>()
----> 1 import mecab
ModuleNotFoundError: No module named 'mecab'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
FLY,安装mecab-python3日志。
!pip install mecab-python3==0.8.0
Collecting mecab-python3==0.8.0
Downloading https://files.pythonhosted.org/packages/db/a6/f528e7a07ad9eeaa506d00ef873d3459ff9b7eba52c9615878571dbc0007/mecab-python3-0.8.tar.gz
Building wheels for collected packages: mecab-python3
Running setup.py bdist_wheel for mecab-python3 ... done
Stored in directory: /root/.cache/pip/wheels/b4/b1/14/2c69b99293f4ba56ff03641c3fe449a371338b919ad37e6942
Successfully built mecab-python3
Installing collected packages: mecab-python3
Successfully installed mecab-python3-0.8
答案 0 :(得分:1)
按照此处的说明进行操作: https://pypi.org/project/mecab-python3/
您需要一些先决条件:
!apt-get install mecab mecab-ipadic-utf8 libmecab-dev swig
然后
!pip install mecab-python3==0.8.0
这是一个完整的笔记本示例:
https://colab.research.google.com/drive/1Ofq1kyVhLuGW2WFDbGVukWVOh5pWTKWz
答案 1 :(得分:0)
我是mecab-python3的维护者。
您的问题似乎是该模块不是mecab
而是MeCab
-请注意大写字母。
请注意,自从在问了这个问题之后不久发布了v0.996.1以来,您不需要安装任何先决条件。而且0.8版不再可用。
您还需要安装字典,但是您可以通过pip进行安装,有关详细信息,请参见the README。