我的Ubuntu系统上有Python,但gcc无法找到Python.h [英] I have Python on my Ubuntu system, but gcc can't find Python.h
问题描述
我正尝试创建可以在Python中运行的C代码。看起来我发现的所有文章都要求你使用
#include< Python.h>
我这样做,但是当我编译它时抱怨没有这样的文件或目录。
计算机有Python(至少它在终端中有 python
命令,我们可以运行任何我们想要的Python代码)。
我在终端中键入 locate Python.h
,但它没有发现任何东西。
我有两个问题:
-
我编写的C代码可以在Python中调用,而不需要
Python.h
? 我缺少一些东西,并且计算机实际上有
Python.h
?
Python.h
的 python-dev
p> I am on a school computer, so I can't install anything.
I am trying to create C code which can be run in Python. It seems all the articles I am finding on it require you to use
#include <Python.h>
I do this, but when I compile it complains that there is no such file or directory.
The computer has Python (at least it has the python
command in the terminal, and we can run whatever Python code we want).
I typed in locate Python.h
in the terminal, but it found nothing.
I have two questions:
Can I write C code that I can call in Python without
Python.h
?Am I missing something, and the computer actually has
Python.h
?
You need the python-dev
package which contains Python.h
这篇关于我的Ubuntu系统上有Python,但gcc无法找到Python.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!