[python-win32] Embedding/bundling Python, best practices?
arve.knudsen at gmail.com
Sun Jan 27 13:40:20 CET 2008
On Jan 25, 2008 7:12 PM, Tim Roberts <timr at probo.com> wrote:
> Arve Knudsen wrote:
> > We're planning to embed Python in our application, which mainly runs
> > on Windows. To avoid dependencies, we want to bundle Python. Do any of
> > you know of any resources on the Web describing best practices for
> > bundling Python with an application, particularly on Windows? I have
> > googled a bit, but most advice I found was to extend Python instead of
> > embedding it, which wasn't very helpful :)
> This is not really that hard to do. The Python interpreter lives in a
> DLL (python25.dll). You just need to call it like any other Windows
> DLL. You have the issue of providing any plugin modules that you need.
> There's a tendency to think that the work is all done in python.exe,
> which would make it difficult to integrate with other applications, but
> that's not the case. Python.exe contains less than 900 bytes of
> executable code. (The whole exe is less than 5k!) It does very little
> other than load python25.dll and call it.
I'm aware that I can disregard the Python executable. The problem is
rather how the Python runtime can be safely bundled. I guess it would
be enough to copy the parts of the Python installation that contains
the Python DLL and its extension modules (standard library as well as
site-packages)? Then Python, when loaded, should be able to find its
library relative to the DLL?
Also, our application is built with VS 2005, should Python also be
built with the same VS version for compatibility?
More information about the python-win32