Мой компьютер - MacOS Mojave 10.14.3.
При установке:
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/lingvisa/anaconda3/envs/chatbot/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-install-ncm7s6a0/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/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-wheel-_61xc4rh --python-tag cp36:
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.7-x86_64-3.6
/usr/local/Cellar/gcc/8.3.0/bin/gcc-8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/lingvisa/anaconda3/envs/chatbot/include -arch x86_64 -I/Users/lingvisa/anaconda3/envs/chatbot/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/lingvisa/anaconda3/envs/chatbot/include/python3.6m -c MeCab_wrap.cpp -o build/temp.macosx-10.7-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.cpp: In function 'void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)':
MeCab_wrap.cpp:8524:22: warning: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying 10 bytes from a string of the same length [-Wstringop-truncation]
strncpy(buff, "swig_ptr: ", 10);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/Users/lingvisa/anaconda3/envs/chatbot/lib -arch x86_64 -L/Users/lingvisa/anaconda3/envs/chatbot/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/MeCab_wrap.o -L/usr/local/Cellar/mecab/0.996/lib -lmecab -lstdc++ -o build/lib.macosx-10.7-x86_64-3.6/_MeCab.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' 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/lingvisa/anaconda3/envs/chatbot/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-install-ncm7s6a0/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/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-record-u3x1oulr/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.7-x86_64-3.6
/usr/local/Cellar/gcc/8.3.0/bin/gcc-8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/lingvisa/anaconda3/envs/chatbot/include -arch x86_64 -I/Users/lingvisa/anaconda3/envs/chatbot/include -arch x86_64 -I/usr/local/Cellar/mecab/0.996/include -I/Users/lingvisa/anaconda3/envs/chatbot/include/python3.6m -c MeCab_wrap.cpp -o build/temp.macosx-10.7-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.cpp: In function 'void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)':
MeCab_wrap.cpp:8524:22: warning: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying 10 bytes from a string of the same length [-Wstringop-truncation]
strncpy(buff, "swig_ptr: ", 10);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/Users/lingvisa/anaconda3/envs/chatbot/lib -arch x86_64 -L/Users/lingvisa/anaconda3/envs/chatbot/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/MeCab_wrap.o -L/usr/local/Cellar/mecab/0.996/lib -lmecab -lstdc++ -o build/lib.macosx-10.7-x86_64-3.6/_MeCab.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
----------------------------------------
Command "/Users/lingvisa/anaconda3/envs/chatbot/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-install-ncm7s6a0/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/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-record-u3x1oulr/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qj/v415xt754t1cllp2z16ld5yh0000gn/T/pip-install-ncm7s6a0/mecab-python3/
Я установил'swig' отдельно, и он отлично работает:
brew install swig
В чем может быть проблема?Я надеюсь, что не нужно никаких изменений для setup.py исходного кода.Это потому, что мой Mac новый?
Спасибо за помощь.