我的 Ubuntu 系统上有 Python,但 gcc 找不到 Python.h [英] I have Python on my Ubuntu system, but gcc can't find Python.h

查看:40
本文介绍了我的 Ubuntu 系统上有 Python,但 gcc 找不到 Python.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学校的电脑上,所以我无法安装任何东西.

I am on a school computer, so I can't install anything.

我正在尝试创建可以在 Python 中运行的 C 代码.看来我在上面找到的所有文章都需要您使用

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.

计算机有Python(至少在终端有python命令,我们可以运行任何我们想要的Python代码).

The computer has Python (at least it has the python command in the terminal, and we can run whatever Python code we want).

我在终端中输入 locate Python.h ,但没有找到.

I typed in locate Python.h in the terminal, but it found nothing.

我有两个问题:

  1. 我可以在没有 Python.h 的情况下编写可以在 Python 中调用的 C 代码吗?

  1. Can I write C code that I can call in Python without Python.h?

我是不是遗漏了什么,而计算机居然有Python.h?

Am I missing something, and the computer actually has Python.h?

推荐答案

您需要包含 Python.h

这篇关于我的 Ubuntu 系统上有 Python,但 gcc 找不到 Python.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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