在 C 文件中包含“Python.h”:
#include <Python.h>
Run Code Online (Sandbox Code Playgroud)
给出Python.h: No such file or directory错误。我查找了其他有同样问题的人,但没有人直接回答如何在 arch Linux 上安装 python*-dev (python2 和 python3)。顺便说一句,这个答案没有 arch 安装命令。
结果“Python.h”已经安装在 Arch 上,但只是不在标准头文件位置,gcc $(pkg-config --cflags python3) testing.c -o testing这为我解决了这个问题。