[常见错误]Python.h: No such file or directory

本文解决了通过源代码安装PyGeSQL过程中遇到的错误,包括找不到Python.h文件的问题及安装Python Imaging Library时出现的错误。提供了详细的解决方案,如通过yum安装python-devel。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个错误是通过source code安装PyGeSQL时遇到的

[root@centos6u2 PyGreSQL-4.0]# python setup.py build
running build
running build_py
running build_ext
building '_pg' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iinclude -I/usr/include -I/usr/include/pgsql/server -I/usr/include/python2.6 -c pgmodule.c -o build/temp.linux-x86_64-2.6/pgmodule.o -O2
pgmodule.c:43:20: error: Python.h: No such file or directory

另外还有一个错误可以通过下面的solution来解决

#安装Python Imaging Library
[root@centos6u2 Imaging-1.1.7]# python setup.py install
...
error: command 'gcc' failed with exit status 1

Solution

目录/usr/include/python2.6/缺少Python.h文件

# CentOS 使用下面命令
# yum install python-devel

 

转载于:https://www.cnblogs.com/wise-man/archive/2012/07/26/2610002.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值