I am on a school computer, so I can\'t install anything.
I am trying to create C code which can be run in Python. It seems all the articles I am finding on it requi
It happens because Python.h
is not located in the default include folder (which is /usr/include/
).
Installing Python-dev might help:
$ sudo apt-get install python-dev
But mostly the problem will persist because the development packages are made inside a separate folder inside the include folder itself ( /usr/include/python2.7
or python3
).
So you should either specify the library folder using -I
option in gcc
or by creating soft-links to everything inside those folders to just outside (I'd prefer the former option).
Using -I
option in gcc
:
$ gcc -o hello -I /usr/include/python2.7 helloworld.c
Creating soft-links :
$ sudo ln -sv /usr/include/python2.7/* /usr/include/