embed python

Peter Strempel peterstrempel at yahoo.com
Thu Mar 11 13:56:16 EST 2004


In article <c2pi2o$17dm$2 at news.riken.go.jp>, Marc Schellens wrote:
> Can somebody tell me how to handle
> this #include issue when embedding python?

Usually "#include "Python.h" is the right way. Then tell your compiler
to add "python2.3" to the include list. On gcc pass "-I/usr/include/python2.3"
or similar to the compilation step.

> Why NOT (according to  the python doc) ude
> #include <python2.3/Python.h>
> ?

Well, you actually can do that, it will work just as above way. But when
you upgrade your Python to 2.4, you need to change your sourcecode. Otherwise
you only need to change your Makefile.

Maybe there is another, more important reason. I don't know. :)


> And which is the library to link if I want to
> use pyhton from my application?

-lpython2.3 (or -lpython23 on some systems) will find the right library,
which is libpython2.3.so in most cases (or libpython23.so or python23.dll
if you are on Win32).


 Peter



More information about the Python-list mailing list