[Tutor] compiling python into an executable
Alan Gauld
alan.gauld at btinternet.com
Sat Apr 28 09:27:48 CEST 2007
"Stevie Broadfoot" <coollikestevie at gmail.com> wrote
> what is a good program to make an executable for all platforms.
I'm not totally clear what you are expecting here.
Python scripts are executable on all platforms as they stand,
you just need the appropriate interpreter to be installed.
Much like a Java program can run on any platform that
has the JVM installed.
> py2app is for osx
I thought py2app simply packaged a Python application
into a MacOS app 'bundle', ie the standard Mac file format/structure.
Python still needs to be installed on the Mac, albeit as part of
the bundle.
> py2exe is for windows
Whereas py2exe produces a binary format file containing
the python interpreter plus any files needed for your
application. This file works like a normal windows binary
executable.
> can I use for linux, windows and macosx.
It is impossible to produce a single executable binary file
that will run natively on all 3 OS, so if that's what you are
looking for it doesn't exist. The nerarest thing would be to
use Jython and compile into Java bytecode, relying on
the fact that most computers now have a JVM installed.
However, if you only want a single tool to produce three
different native executable formats then I suspect Gordon
MacMillan's installer might be the closest, although I'm not
sure of its status since I haven't heard of anyone using it
recently. But it certainly didv Linux and Windows and I
wouldn't be surprised if it now did Mac too...
> Or does there not exist such a program?
> I'm on ubuntu edgy eft at the moment.
These kind of executable bundling programs aren't
that commonly used on Unix programs because there
is a long tradition of using scripting languages on Unix.
Nearly all Unix installs come with a range of interpreters
(sh, sed, awk, m4, perl, Tcl, scheme, etc) and adding Python,
in the rare case that its not there already, is unlikely
to stress out any Unix admin.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list