[Tutor] Tutorial executable from python script.

Alan Gauld alan.gauld at btinternet.com
Fri Mar 19 20:39:57 CET 2010


"Karim Liateni" <karim.liateni at free.fr> wrote

> on machine which doesn't have recent version (2.0) of python. 

Given that v2 is at least 10 years old now that's not really "recent"
I'd be surprised if any current Linux distros had anything that old 
on them! Even the ones designed for old hardware.
In fact, are you sure your code runs on v1 python? There have 
been a lot of language changes since then.

> the compile()
> method but how can I use it to make all in one executable 

compile() doesn't make an exe, it compiles python script into 
python byte code - much as the javac compiler compiles 
java source into java bytecode.

> run on old system (old python). 

Exactly how old is old?

If you write the code to run on an old Python interpreter it should 
still work(mostly!) on Python 2.6. The trick is not to compile the 
code but to write code that is consistent wityh the oldest version 
of Python you need to run on.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list