pip install nmslib失敗(error:command'x 86_64-linux-gnu-gcc'failed with exit status 1)

5093 ワード

1.問題現象
pipを使用してnmslibコマンドをインストールすると、次のエラーが発生します.
sudo pip install nmslib
....

ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-OKEXAd/nmslib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r
'
"'"', '"'"'
'
"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-NUl5Qs --python-tag cp27: ERROR: running bdist_wheel running build running build_ext creating tmp x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c /tmp/tmpgSa_ft.cpp -o tmp/tmpgSa_ft.o -std=c++14 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c /tmp/tmpih024X.cpp -o tmp/tmpih024X.o -fvisibility=hidden cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ building 'nmslib' extension creating build creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/nmslib creating build/temp.linux-x86_64-2.7/nmslib/similarity_search creating build/temp.linux-x86_64-2.7/nmslib/similarity_search/src creating build/temp.linux-x86_64-2.7/nmslib/similarity_search/src/method creating build/temp.linux-x86_64-2.7/nmslib/similarity_search/src/space x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I./nmslib/similarity_search/include -I/usr/local/include/python2.7 -I/home/deepnorth/.local/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c nmslib.cc -o build/temp.linux-x86_64-2.7/nmslib.o -O3 -march=native -fopenmp -DVERSION_INFO="1.7.3.6" -std=c++14 -fvisibility=hidden cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ nmslib.cc:16:31: fatal error: pybind11/pybind11.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for nmslib ...

2.解決方法
 sudo apt-get install unixodbc-dev
 sudo pip install nmslib