Essentially, I want to do this:
#include <Python.h>
int main(int argc, char *argv[]) {
Py_SetProgramName(argv[0]);
Py_Initialize();
PyRun_SimpleString("from time import time, ctime\n"
"print 'Today is', ctime(time())\n");
Py_Finalize();
return 0;
}
I successfully got my C code to include Python.h by instructing Eclipse to "include" the folder
C:\Users\Thomas\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\includes
which contains Python.h
My understanding is that, in order to successfully implement Python in C, I also have to link Eclipse to the Python library (provide the path to the library's directory and provide the name of the library).
I know how to do this. However, I do not know where the Python library is located in enthought canopy. (I've spent a long time looking)
In a similar question I have Python on my Ubuntu system, but gcc can't find Python.h , someone commented
Pass
-I /home/username/python/include
to gcc when compiling to make it aware ofPython.h
. Pass-L /home/username/python/lib
and-lpython2.7
when linking."
If I'm running python on canopy, what do I use for the -L
and -l
arguments?
Thanks, and let me know if I need to clarify anything. (I'm new to C and a relatively inexperienced programmer)