hirhirの日記

Pythonとデータ分析と人口知能

mecab インストール

MeCabのダウンロード
MeCab 本体

$ wget http://mecab.googlecode.com/files/mecab-0.993.tar.gz
MeCab 用の辞書 (IPA 辞書)

$ wget http://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz
インストール
本体のインストール

$ tar zxfv mecab-0.993.tar.gz
$ cd mecab-0.993
$ ./configure
$ make
$ make check
$ sudo make install
※こんな感じのエラーが出た場合、

configure: error: Your compiler is not powerful enough to compile MeCab. If it should be, see config.log for more information of why it failed.
C++コンパイラがうまく入っていない可能性があるので sudo aptitude install build-essential をリトライするか、もしくは sudo aptitude install g++ でインストールしてみる。

辞書のインストール

$ tar zxfv mecab-ipadic-2.7.0-20070801.tar.gz
$ mecab-ipadic-2.7.0-20070801
$ ./configure --with-charset=utf8
$ make
$ sudo make install
※辞書のインストール時に以下のようなエラーがでることがある。

/usr/local/libexec/mecab/mecab-dict-index: error while loading shared libraries: libmecab.so.2: cannot open shared object file: No such file or directory
これは共有ライブラリがシステムに認識されていないことが原因なので、sudo ldconfig を実行してリトライする。