Ask coding questions

← Back to all posts
Python.h not working
ANDREWVOSS (187)

I wanted to use embedded Python code in C to test how it works, so I found some code online that can do just that. But when I try to run it using #include <Python.h> it gives me an error saying

main.c:1:10: fatal error: 'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~

Is there a way to fix this?

Answered by Coder100 (18123) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18123)

that's because you are compiling it wrong
read this

ANDREWVOSS (187)

@Coder100 I'm not very experienced in C. How would I compile it correctly?

Coder100 (18123)

edited the comment, please read @ANDREWVOSS

Coder100 (18123)

anyways, right now it is compiling with gcc, which isn't actually python, if you know what I mean @ANDREWVOSS

ANDREWVOSS (187)

@Coder100 Thanks. I'll see if that fixes the issue. I know that python.h is kind of a weird module.

Coder100 (18123)

yeah it requires special set up @ANDREWVOSS

TentenDxD (0)

@ANDREWVOSS i'm confused; what did you have to do?