centos 7にannoyをインストールする

2869 ワード

情報の確認:
# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

# python -V
Python 2.7.5

インストールpip
yum -y install python-pip

インストールannoy
# pip install annoy
Collecting annoy
  Downloading https://files.pythonhosted.org/packages/b5/28/f8ce7400344090bb5cfa1c9fae3fdb03b9438db082d458686442633d82a3/annoy-1.15.0.tar.gz (635kB)
    100% |████████████████████████████████| 645kB 155kB/s 
Installing collected packages: annoy
  Running setup.py install for annoy ... error
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f3WUsu/annoy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r
', '
'), __file__, 'exec'))" install --record /tmp/pip-IEqdkr-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/annoy copying annoy/__init__.py -> build/lib.linux-x86_64-2.7/annoy running build_ext building 'annoy.annoylib' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c src/annoymodule.cc -o build/temp.linux-x86_64-2.7/src/annoymodule.o -O3 -ffast-math -fno-associative-math -march=native src/annoymodule.cc:17:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f3WUsu/annoy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r
', '
'), __file__, 'exec'))" install --record /tmp/pip-IEqdkr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-f3WUsu/annoy/ You are using pip version 8.1.2, however version 18.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

この問題を解決するには、次の手順に従います.
# yum install python-devel

その後、annoyをインストールできます.