python安装python-lzf包,报错lzf_module.c:3:20: fatal error: Python.h: No such file or directory
问题
安装python-lzf包,报错:
[root@nccztsjb-node-19 python3]# cd python-lzf-0.2.4
[root@nccztsjb-node-19 python-lzf-0.2.4]#
[root@nccztsjb-node-19 python-lzf-0.2.4]# python3 setup.py install
running install
running bdist_egg
running egg_info
writing python_lzf.egg-info/PKG-INFO
writing dependency_links to python_lzf.egg-info/dependency_links.txt
writing top-level names to python_lzf.egg-info/top_level.txt
reading manifest file 'python_lzf.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_lzf.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'lzf' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -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. -I/usr/include/python3.6m -c lzf_module.c -o build/temp.linux-x86_64-3.6/lzf_module.o -Wall
lzf_module.c:3:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
原因
缺少 python3-devel包,即缺少开发环境包!
解决
yum install -y python3-devel
或者
yum install -y python-devel