[python-win32] Embedding/bundling Python, best practices?

Tim Roberts timr at probo.com
Mon Jan 28 19:20:56 CET 2008


Arve Knudsen wrote:
>
> 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?
>   

You need to set the Python path variable before calling the 
interpreter.  You can do that by setting the PYTHONPATH environment 
variable, but I believe you can also do that by setting variables when 
you initialize the interpreter.

Py2exe might prove useful for you, if only because it scans through a 
Python script and determines exactly which auxiliary DLLs and modules 
the script needs in order to operate in a standalone environment.

> Also, our application is built with VS 2005, should Python also be
> built with the same VS version for compatibility?
>   

Yes, this is required.  The Python run-time DLL links to the Visual C++ 
run-time library.  My python24.dll, for example, links to msvcr71.dll, 
which is the run-time from VS 2003.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list