7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacのgccでmecabインストールがコケるときはHomebrew経由でgccを入れる

Posted at

pip install mecab-python3 でエラー

2019/01/15現在、Macデフォルトのgcc (xcode-select経由で入るもの)では mecab-python3 のインストール時にエラーが出る。

#include <stdexcept>
             ^~~~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

そのため、Homebrew経由のgccを使う必要がある。

Mecabインストール

$ brew install mecab
$ brew install mecab-ipadic

gccインストール

$ brew install gcc
$ ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc
$ ln -s /usr/local/bin/g++-8 /usr/local/bin/g++

.bash_profile なり .zshrc なりを編集して、
$ which gcc/usr/local/bin/gcc となるようにする。

mecab-python3 インストール

$ brew install swig
$ pip install mecab-python3

以上でインストールができる。

7
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?