You are not logged in.
I am trying to convert a more complex Python script into C with C. But in order to get used to Cython i thought of trying first to convert a simple HelloWorld.py into C, so trivially it look some kind like this:
HelloWorld.py
def main():
print("Hello, World!")
if __name__ == '__main__':
main()
I am compiling the resuting C program like this:
HelloWorld.c
gcc HelloWorld.c -o HelloWorld
And what i always get is this:
HelloWorld.c:8:22: fatal error. pyconfig.h: No such file or directory compilation terminated.
#include "pyconfig.h"
^
I found a similiar post here, which unfortunately did not really help.
Offline
Solved. For everybody who is interested:
Fix the Include in your Cython converted C-File, like this:
#include "python2.7/Python.h" instead of #include "Python.h".
Offline
Instead of touching automatically generated C files use pkg-config
gcc `pkg-config --libs --cflags python2` -c test.c -o test.o
or python3 if you want python 3.x
Offline