10
5

More than 5 years have passed since last update.

Jupyter NotebookでMeCabとNEologdをインポートするまで(Mac)

Posted at

AnacondaではMeCabをインストールできない?

普段は「$conda install ~」でインストールを行っているが

$ conda install mecab-python3

Macのターミナルで上記コマンドを実行すると・・・

WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - mecab-python3

Current channels:

  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/osx-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

( ´ω` ):

$pip install を使う

色々調べた結果、AnacondaではMeCabをインストールできないらしく、
pip install で実行しろとのことでした。。。

$ pip install mecab-python3

この方法でも上手くいかない場合はjupyter notebookに直接下記コードを入力します。
image.png

すると。。
image.png

とりあえずMeCabは使えるようになりました( ◜ω◝ )
(Pythonの初期構築で色々苦労したのでcondaコマンド以外でのインストールはあまりしたくないのです。。)

NEologdのインストール

NEologdをインストールするには「git clone」コマンドを使うそうで・・・

とりあえず、MeCabのディレクトリまで移動して。。

$ cd [めかぶディレクトリ]
$git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git
$cd mecab-ipadic-neologd
$./bin/install-mecab-ipadic-neologd
[install-mecab-ipadic-NEologd] : Start..
[install-mecab-ipadic-NEologd] : Check the existance of libraries
[install-mecab-ipadic-NEologd] :     find => ok
[install-mecab-ipadic-NEologd] :     sort => ok
[install-mecab-ipadic-NEologd] :     head => ok
[install-mecab-ipadic-NEologd] :     cut => ok
[install-mecab-ipadic-NEologd] :     egrep => ok
[install-mecab-ipadic-NEologd] :     mecab is not found.

(-ω-`)⌒)_

もしかして。。

image.png

あ、同じ方法でいけました笑

終わり。

10
5
0

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
10
5