Mac에 mecab-python3을 도입하려고 시도한 고난 이야기
개요
챗봇 만들기 연습으로 Mac에 파이썬 3을 설치하려고하면 의외로 고전했으므로 절차와 고전 포인트를 공유합니다.
설치 환경
1. MeCab 설치
먼저 MeCab 본문과 사전을 설치합니다. 이것이 없으면 mecab-python3도 넣을 수 없습니다.
설치 절차
Terminal$ brew install mecab
$ brew install mecab-ipadic
여기까지 끝나면, 제대로 설치할 수 있었는지 확인합시다.
터미널에서 mecab
를 입력하면 입력 대기 상태가되고 적절한 문장을 칠 수 있습니다.
아래와 같이 해설이 나오면 MeCab의 인스톨은 완료입니다.
Terminal$ mecab
おはようございます
おはよう 感動詞,*,*,*,*,*,おはよう,オハヨウ,オハヨー
ござい 助動詞,*,*,*,五段・ラ行特殊,連用形,ござる,ゴザイ,ゴザイ
ます 助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス
EOS
2. SWIG 설치
SWIG(Simplified Wrapper and Interface Generator)는 C/C++로 작성된 프로그램이나 라이브러리를, Tcl/Tk, Perl, Python, Ruby, PHP, Lua 등의 스크립트 언어나, Java, C#, Common Lisp, Scheme, Ocaml과 같은 프로그래밍 언어에 연결하기위한 오픈 소스 도구입니다. (Wikipedia)
MeCab은 C++로 작성 되었습니까?
우선 SWIG는 MeCab을 python3에서 사용할 수 있도록 해주는 도구 인 것 같습니다.
mecab-python3을 설치하기 전에 이것을 넣지 않으면 오류가 발생합니다.
설치 절차
이것은 간단
Terminal$ brew install swig
설치할 수 있었는지는 아래의 명령으로 버전이 나오면 알 수 있습니다.
Terminal$ swig -version
SWIG Version 3.0.12
Compiled with clang++ [x86_64-apple-darwin18.0.0]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information
3. mecab-python3 설치
글쎄, 다시 했어!
마침내 진정한 mecab-python3 설치입니다!
다음 명령을 입력하세요.
Terminal$ pip install mecab-python3
이것으로 갈 수 있습니다 ... 이상한 이상한 오류가 나왔습니다.
Terminal$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-wheel-y30lec8x --python-tag cp35:
running bdist_wheel
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Failed building wheel for mecab-python3
Running setup.py clean for mecab-python3
Failed to build mecab-python3
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3 ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/
아무래도 여러가지 쓰고 있습니다만, 「〇〇를 인스톨 해」라든가 「××를 찾을 수 없습니다」같은 간단한 에러가 아닌 것 같다(울음)
만사를 쉬겠다고 생각했는데, 검색하면 비슷한 문제를 만나는 것이 다른 것 같았고, 아무래도 커맨드 라인 툴이 최신의 것이라면 작동하지 않는 것 같습니다.
그런 것을 조사하지 않으면 모른다 (T _ T)
과거의 명령줄 도구는 Apple 개발자 사이트에서 다운로드할 수 있습니다.
htps : //로 ゔぇぺぺr. 아 ぇ. 코 m / 도 w 응 아 d / 누레 /
위 사이트에 로그인하여 아래 Xcode 9.4 패키지를 다운로드했습니다.
이 패키지에서 설치하고 다시 챌린지
Terminal$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... done
Stored in directory: /Users/Lappiness/Library/Caches/pip/wheels/73/71/4f/63a79925b5e9bb38932043917cc60140beb8022ac14a952b1e
Successfully built mecab-python3
Installing collected packages: mecab-python3
Successfully installed mecab-python3-0.996.1
거짓말처럼 깔끔하게 설치가 완료되었습니다. (^^;;
우선 샘플 코드도 올릴 때입니다.
Sapmle.pyimport MeCab
mecab = MeCab.Tagger("-Ochasen") # MeCabオブジェクトを作成
malist = mecab.parse("すもももももももものうち") # 形態素解析を行う
print(malist)
실행 결과すもも スモモ すもも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
の ノ の 助詞-連体化
うち ウチ うち 名詞-非自立-副詞可能
EOS
제대로 움직였습니다.
글쎄, 죄송합니다.
참고한 기사
$ brew install mecab
$ brew install mecab-ipadic
$ mecab
おはようございます
おはよう 感動詞,*,*,*,*,*,おはよう,オハヨウ,オハヨー
ござい 助動詞,*,*,*,五段・ラ行特殊,連用形,ござる,ゴザイ,ゴザイ
ます 助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス
EOS
SWIG(Simplified Wrapper and Interface Generator)는 C/C++로 작성된 프로그램이나 라이브러리를, Tcl/Tk, Perl, Python, Ruby, PHP, Lua 등의 스크립트 언어나, Java, C#, Common Lisp, Scheme, Ocaml과 같은 프로그래밍 언어에 연결하기위한 오픈 소스 도구입니다. (Wikipedia)
MeCab은 C++로 작성 되었습니까?
우선 SWIG는 MeCab을 python3에서 사용할 수 있도록 해주는 도구 인 것 같습니다.
mecab-python3을 설치하기 전에 이것을 넣지 않으면 오류가 발생합니다.
설치 절차
이것은 간단
Terminal
$ brew install swig
설치할 수 있었는지는 아래의 명령으로 버전이 나오면 알 수 있습니다.
Terminal
$ swig -version
SWIG Version 3.0.12
Compiled with clang++ [x86_64-apple-darwin18.0.0]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information
3. mecab-python3 설치
글쎄, 다시 했어!
마침내 진정한 mecab-python3 설치입니다!
다음 명령을 입력하세요.
Terminal$ pip install mecab-python3
이것으로 갈 수 있습니다 ... 이상한 이상한 오류가 나왔습니다.
Terminal$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-wheel-y30lec8x --python-tag cp35:
running bdist_wheel
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Failed building wheel for mecab-python3
Running setup.py clean for mecab-python3
Failed to build mecab-python3
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3 ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/
아무래도 여러가지 쓰고 있습니다만, 「〇〇를 인스톨 해」라든가 「××를 찾을 수 없습니다」같은 간단한 에러가 아닌 것 같다(울음)
만사를 쉬겠다고 생각했는데, 검색하면 비슷한 문제를 만나는 것이 다른 것 같았고, 아무래도 커맨드 라인 툴이 최신의 것이라면 작동하지 않는 것 같습니다.
그런 것을 조사하지 않으면 모른다 (T _ T)
과거의 명령줄 도구는 Apple 개발자 사이트에서 다운로드할 수 있습니다.
htps : //로 ゔぇぺぺr. 아 ぇ. 코 m / 도 w 응 아 d / 누레 /
위 사이트에 로그인하여 아래 Xcode 9.4 패키지를 다운로드했습니다.
이 패키지에서 설치하고 다시 챌린지
Terminal$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... done
Stored in directory: /Users/Lappiness/Library/Caches/pip/wheels/73/71/4f/63a79925b5e9bb38932043917cc60140beb8022ac14a952b1e
Successfully built mecab-python3
Installing collected packages: mecab-python3
Successfully installed mecab-python3-0.996.1
거짓말처럼 깔끔하게 설치가 완료되었습니다. (^^;;
우선 샘플 코드도 올릴 때입니다.
Sapmle.pyimport MeCab
mecab = MeCab.Tagger("-Ochasen") # MeCabオブジェクトを作成
malist = mecab.parse("すもももももももものうち") # 形態素解析を行う
print(malist)
실행 결과すもも スモモ すもも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
の ノ の 助詞-連体化
うち ウチ うち 名詞-非自立-副詞可能
EOS
제대로 움직였습니다.
글쎄, 죄송합니다.
참고한 기사
$ pip install mecab-python3
$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-wheel-y30lec8x --python-tag cp35:
running bdist_wheel
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Failed building wheel for mecab-python3
Running setup.py clean for mecab-python3
Failed to build mecab-python3
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3 ... error
Complete output from command /Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building '_MeCab' extension
swigging MeCab.i to MeCab_wrap.cpp
swig -python -shadow -c++ -I/usr/local/Cellar/mecab/0.996/include -o MeCab_wrap.cpp MeCab.i
/usr/local/Cellar/mecab/0.996/include/mecab.h:848: Warning 302: Identifier 'set_sentence' redefined by %extend (ignored),
MeCab.i:89: Warning 302: %extend definition of 'set_sentence'.
creating build
creating build/temp.macosx-10.6-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/include/python3.5m -c MeCab_wrap.cpp -o build/temp.macosx-10.6-x86_64-3.5/MeCab_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
MeCab_wrap.cpp:3051:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Users/Lappiness/.pyenv/versions/anaconda3-4.1.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/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 /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-record-rwbur4g_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/n1/wmr8p0zd6lb265ryzrg55rz80000gn/T/pip-install-ls4os91_/mecab-python3/
$ pip install mecab-python3
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/ac/48/295efe525df40cbc2173748eb869290e81a57e835bc41f6d3834fc5dad5f/mecab-python3-0.996.1.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... done
Stored in directory: /Users/Lappiness/Library/Caches/pip/wheels/73/71/4f/63a79925b5e9bb38932043917cc60140beb8022ac14a952b1e
Successfully built mecab-python3
Installing collected packages: mecab-python3
Successfully installed mecab-python3-0.996.1
import MeCab
mecab = MeCab.Tagger("-Ochasen") # MeCabオブジェクトを作成
malist = mecab.parse("すもももももももものうち") # 形態素解析を行う
print(malist)
すもも スモモ すもも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
も モ も 助詞-係助詞
もも モモ もも 名詞-一般
の ノ の 助詞-連体化
うち ウチ うち 名詞-非自立-副詞可能
EOS
Reference
이 문제에 관하여(Mac에 mecab-python3을 도입하려고 시도한 고난 이야기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/TomOse/items/90a6addda3b0419f40e3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)