致命错误:Python.h:没有那个文件或目录 [英] fatal error: Python.h: No such file or directory
本文介绍了致命错误:Python.h:没有那个文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 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.
我已经通过互联网尝试了所有建议的解决方案,但问题仍然存在.我对 Python.h
没有问题.我设法在我的机器上找到了该文件.
I have tried all the suggested solutions over the internet but the problem still exists. I have no problem with Python.h
. I managed to locate the file on my machine.
推荐答案
我设法解决了这个问题并在一个命令中生成了 .so 文件
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屋!
查看全文