bundling python with application

Randall Smith randall at tnr.cc
Sat Jul 26 20:58:38 EDT 2008


I'd like to bundle Python with my app, which will be targeted at Linux, 
Windows and Mac.  Discussions I've found about this tend to lead to 
py2exe, freeze, etc, but I'd like to do something rather simple and am 
seeking advice.

What I'd like to do is just copy the standard libraries and 
executable(s) and adjust the paths in the environment variables.  The 
libraries and executable(s) would reside in the same directory with the 
application so that you could run the application without needing to 
install it.  The directory might look like this:

$ ls

start-app.sh
app_lib/
python_lib/
python_bin/


start-app.sh would look like this:

#!/bin/sh

PATH="python_bin:$PATH" PYTHON_HOME="./python_lib" python app_lib/start.py

Of course, there would be a start-app.bat for Windows.

The PATH is altered to make sure the right python interpreter is found 
and PYTHON_HOME makes sure the right (local) libraries are found.

Can this be done?

Randall




More information about the Python-list mailing list