Ask coding questions

← Back to all posts
Python.h not working
ANDREWVOSS

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

Is there a way to fix this?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
ANDREWVOSS
Comments
hotnewtop
Coder100

that's because you are compiling it wrong
read this

ANDREWVOSS

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

Coder100

edited the comment, please read @ANDREWVOSS

Coder100

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

ANDREWVOSS

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

Coder100

yeah it requires special set up @ANDREWVOSS

TentenDxD

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