Help us understand the problem. What is going on with this article?

python3でMeCabがinstallできない!

More than 1 year has passed since last update.

Mecabはこのコマンドを入力すればインストールできると書いてあったので実行

pip install mecab-python3

結果

Collecting mecab-python3
  Using cached https://files.pythonhosted.org/packages/25/e9/bbf5fc790a2bedd96fbaf47a84afa060bfb0b3e0217e5f64b32bd4bbad69/mecab-python3-0.7.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: mecab-config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/db/zj9vr1xx11vdn8yzb3bvp6xw0000gn/T/pip-install-31zuvfh1/mecab-python3/setup.py", line 41, in <module>
        include_dirs=cmd2("mecab-config --inc-dir"),
      File "/private/var/folders/db/zj9vr1xx11vdn8yzb3bvp6xw0000gn/T/pip-install-31zuvfh1/mecab-python3/setup.py", line 21, in cmd2
        return cmd1(strings).split()
      File "/private/var/folders/db/zj9vr1xx11vdn8yzb3bvp6xw0000gn/T/pip-install-31zuvfh1/mecab-python3/setup.py", line 18, in cmd1
        return os.popen(strings).readlines()[0][:-1]
    IndexError: list index out of range

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/db/zj9vr1xx11vdn8yzb3bvp6xw0000gn/T/pip-install-31zuvfh1/mecab-python3/

すると最後に、次のエラーが出てインストールができない!!!

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/db/zj9vr1xx11vdn8yzb3bvp6xw0000gn/T/pip-install-31zuvfh1/mecab-python3/

setup.pyを書き換えればよいみたいな記事もあったのですが、自分は以下のコマンドを実行した後に、再び実行したらエラーが発生せず、無事にインストールすることができました。

brew install mecab-ipadic

==> Installing dependencies for mecab-ipadic: mecab
==> Installing mecab-ipadic dependency: mecab
==> Downloading https://homebrew.bintray.com/bottles/mecab-0.996.el_capitan.bottle.3.tar.gz
######################################################################## 100.0%
==> Pouring mecab-0.996.el_capitan.bottle.3.tar.gz
🍺  /usr/local/Cellar/mecab/0.996: 20 files, 4.2MB
==> Installing mecab-ipadic
==> Downloading https://homebrew.bintray.com/bottles/mecab-ipadic-2.7.0-20070801.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mecab-ipadic-2.7.0-20070801.el_capitan.bottle.tar.gz
==> Caveats
To enable mecab-ipadic dictionary, add to /usr/local/etc/mecabrc:
  dicdir = /usr/local/lib/mecab/dic/ipadic
==> Summary
🍺  /usr/local/Cellar/mecab-ipadic/2.7.0-20070801: 15 files, 50.6MB


pip install mecab-python3

Collecting mecab-python3
  Using cached https://files.pythonhosted.org/packages/25/e9/bbf5fc790a2bedd96fbaf47a84afa060bfb0b3e0217e5f64b32bd4bbad69/mecab-python3-0.7.tar.gz
Building wheels for collected packages: mecab-python3
  Running setup.py bdist_wheel for mecab-python3 ... done
  Stored in directory: /Users/admin/Library/Caches/pip/wheels/4c/07/3a/5f22ccc9f381f3bc01fa023202061cd1e0e9af855292f005dd
Successfully built mecab-python3
Installing collected packages: mecab-python3
Successfully installed mecab-python3-0.7

解決👍

machine-absentstudent
休学中の大学生です。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした