Reputation: 107
I am on an Ubuntu machine and I want to use python in my C code but when I include the Python.h
header file, it shows a warning:
Python.h: No such file or directory
Any method for this. I have already tried to use:
sudo apt-get install python3-dev
and;
sudo apt-get install python-dev
But it keeps showing error.
Upvotes: 0
Views: 90
Reputation: 2093
The Python.h file is not in the default compiler include path.
Add the output of pkg-config --cflags python3
to your compiler command line.
Now the compiler will know where to find Python.h (and any dependencies it may have)
Upvotes: 1