質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Mecab

Mecabは、オープンソースの形態素解析エンジンです。 言語、辞書、コーパスに依存しない汎用的な設計を基本方針としています。 Mecabの由来は、開発者の好物である和布蕪(めかぶ)から名づけられました。

Q&A

解決済

1回答

3371閲覧

mecab-python3がインストールできません

yep

総合スコア45

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Mecab

Mecabは、オープンソースの形態素解析エンジンです。 言語、辞書、コーパスに依存しない汎用的な設計を基本方針としています。 Mecabの由来は、開発者の好物である和布蕪(めかぶ)から名づけられました。

0グッド

0クリップ

投稿2018/09/12 09:07

下記のようにmecab-python3がインストールできません。

何卒、よろしくお願いいたします。

root@***:~$ sudo pip3 install mecab-python3

The directory '/home/yudai/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mecab-python3
Downloading https://files.pythonhosted.org/packages/25/e9/bbf5fc790a2bedd96fbaf47a84afa060bfb0b3e0217e5f64b32bd4bbad69/mecab-python3-0.7.tar.gz (41kB)
100% |████████████████████████████████| 51kB 1.5MB/s
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3 ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-v1x2vtef/mecab-python3/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-kfuoy7l5/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying MeCab.py -> build/lib.linux-x86_64-3.6
running build_ext
building '_MeCab' extension
creating build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/python3.6m -c MeCab_wrap.cxx -o build/temp.linux-x86_64-3.6/MeCab_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
MeCab_wrap.cxx:149:10: fatal error: Python.h: そのようなファイルやディレクトリはありません
include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-v1x2vtef/mecab-python3/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-kfuoy7l5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-v1x2vtef/mecab-python3/

#環境
$ uname -a
Linux NAGARE 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

python -V
python 2.7.15rc1

python3 -V
Python 3.6.6+

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

quickquip

2018/09/12 10:10

このpythonはどこにありますか? pip3 -V と python3 -m pip -V の結果一致しますか?
yep

2018/09/12 11:45

はい。一致しています。pip3 -V、python3 -m pip -Vは共にpip 18.0 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)となっています。
quickquip

2018/09/12 12:58 編集

ああ、これは、Python3.6.6を自分でビルドして /usr/local にインストールしたという環境ですね?
yep

2018/09/12 13:03

はい、そうです。
guest

回答1

0

ベストアンサー

python.hというヘッダーファイルがないということですので、以下を実行してから再度インストールを試してみると変わるかもしれません。

sudo apt-get install python3-dev

投稿2018/09/12 13:03

denzow

総合スコア640

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yep

2018/09/12 13:13

ありがとうございました!正常にインストールできました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問