LoginSignup
2
4

More than 5 years have passed since last update.

【AWS+Ubuntu16.04】MeCab環境を入れるbash書いたよ!

Posted at

AWSに自然言語処理のMeCabをインストールする時に色々調べて、サイトの内容を試したりしていったのですが、前提条件がわからなかったり、いくつかエラーが出てしまったので、最短で環境を完成させるインストールbashを書きました。

AWSで建てたばかりのUbuntuインスタンスで起動確認できています。

インストールBash

natural-language-requirements.sh
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo apt install libmecab2 libmecab-dev mecab mecab-ipadic mecab-ipadic-utf8 mecab-utils
sudo apt install python3-pip -y
sudo apt install swig -y
sudo pip3 install mecab-python3

MeCabインストールでエラーでるパターン

MeCab環境構築でエラーが出た!という記載を見ていると、下記の2つで解決できることが多かったので補足として載せておきます。

swigインストールを行っていない

swigをインストールしないとパッケージインストールでエラーが出るので、下記のコマンドが必要です。

#!/bin/bash
sudo apt install swig -y

pipでエラーが出る

pipでのインストールの場合、環境の構築状況によりエラーが発生するため、pip3でインストールするとうまくいくことが多いです。

#!/bin/bash
sudo pip3 install mecab-python3
2
4
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
2
4