致命错误:Python.h:没有这样的文件或目录 [英] fatal error: Python.h: No such file or directory

查看:1044
本文介绍了致命错误:Python.h:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C扩展名文件构建共享库,但首先必须使用以下命令生成输出文件:

  gcc -Wall utilsmodule.c -o Utilc 

After执行命令,我得到这个错误消息:


utilsmodule.c:1:20:致命错误:Python.h:没有这样的文件或目录
编译终止。


事实上,我已经尝试了所有通过互联网提出的解决方案,但问题仍然存在。 ..我也没有问题 Python.h 。我设法找到我的机器上的文件...任何人都面临同样的问题之前??

解决方案

我设法解决在一个命令中生成.so文件

I / usr / include / python2.7 -lpython2.7 utilsmodule.c


I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:

gcc -Wall utilsmodule.c -o Utilc

After executing the command, I get this error message:

utilsmodule.c:1:20: fatal error: Python.h: No such file or directory compilation terminated.

in fact I have tried all the suggested solutions over the internet but the problem still exists ... also I have no problem with Python.h. I managed to locate the file on my machine ... anybody has faced the same problem before??

解决方案

I managed to solve this issue and generate the .so file in one command

gcc -shared -o UtilcS.so
-fPIC -I/usr/include/python2.7 -lpython2.7  utilsmodule.c

这篇关于致命错误:Python.h:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆