
Hello,
please, I have a bit of trouble grasping a few very basic concepts related to Python embedding, could someone explain those to me?
What I try to achieve is to have single one (big) binary, which contains my Python script, the wrapper and Python interpreter itself, I'm on MacOS 10.6. My questions are:
- I would like to build Python myself. I downloaded Python 3.3 beta source
code, extracted it in a folder. Next to "Python-3.3.0b1" folder, there is a file "test.c" which contains:
#include <Python.h>
int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print('Today is', ctime(time()))\n"); Py_Finalize(); return 0; }
Now, what should I do next? I though I would just "somehow" compile and link Python source code with test.c and that's it but when I do "gcc -I ./Python-3.3.0b1 -o test test.c" I get lots of errors. (Note: I'm total noob what this whole gcc and static linking and .a files goes...)
- Next I tried to run "./configure" and "make". It finished without errors
and it creates "build/lib.macosx-10.6-x86_64-3.3" folder with lots of *.so (?) files but I'm not sure how to make use of them.
If building everything from scratch (the first step above) is not an option, what do I need to build? A "framework"? .dylib? .a? And than link test.o against that?
- How does Python from python.org get build? Do they use the same
"./configure" and "make" as I can? Do they use any special option?
To summarize, I have Python source code and test.c and I would like to have one executable which says "Today is ....". Could someone, please, explain in layman terms, the necessary steps?
Thanks you very much in advance!
Ecir Hana