Minimal Python installation?

Thomas Troeger thomas.troeger.ext at siemens.com
Wed May 21 06:07:12 EDT 2008


Hi,

I'd like to put the python library and interpreter on a small embedded 
Linux x86 compatible device where disk space is an issue. I played 
around with the minimal Python interpreters, but was not entirely happy 
with them, so my question is, is there an (preferably easy) way to put 
the interpreter and a cut-down version of the python library/modules 
that ship with regular Python into a new archive that I can safely copy 
and use? My current method is to copy the python interpreter and the 
python shared library to the device. Then I create a tar archive with 
all startup files from the site package directory to my archive using 
the following one-liner:

strace -f -eopen python -c 'pass' 2>&1 | grep -v ENO | grep '\.py' | awk 
'BEGIN { FS="\"" } { print $2 }' | tar cvf x.tar -T -

This effectively packs all python library files that are accessed upon 
startup into a tar archive. But I figure this method is not what I want 
because there surely are files I am missing here (for example which are 
accessed when starting a script), and what I really want is a minimal 
environment that works. Let's say I want a complete Python install, but 
without all the batteries :-)

Any pointers?

Regards,
Thomas.



More information about the Python-list mailing list