[Tutor] Compile python to executable binary?

D-Man dsh8290@rit.edu
Sat, 30 Dec 2000 23:34:25 -0500


On Sat, Dec 30, 2000 at 11:16:13AM -0600, Jose Alberto Abreu wrote:
> D-Man wrote:
> > 
> > I can't answer all of the questions, but you can run your app without
> > a separate interpreter installed on the machine *if*
> > 
> > 1)      You package an interpreter with your installer
> >         (basically you provide it for them)
> 
> But how do you do that: put the interpreter, the required modules and
> your code on a couple of .exe's or perhaps using installshield (in the
> case of Windows, for example).

I don't know anything about configuring InstallShield, but I would
expect that it would allow you to make an installer for python and
have it install python as part of the install process.  Maybe just
include it in a tarball (or zip file, winzip can read tarballs too)
and tell the users to install it first?
> 
> Distributing python programs for Linux is much easier, as almost all
> linux distributions will install (at least) python 1.5, but trying to
> get the average Windows user to go and download and install python so
> that they can run your code is not realistic.
> 
> > or
> > 
> > 2)      You package an interpreter with your program.  Maybe make a
> > little C program that embeds the interpreter and runs your scripts.
> 
> Is there an opensourced thing that does this?

I think this would have to be a custom sort of thing.  Maybe not.
Someone was mentioning byte-compiling his scripts, then putting the
byte-code in a static C array and embedding the interpreter and
handing it those arrays to execute.  I don't remember if that person
was on this list or python-list.



There's also a utility called "freeze" that is distributed by
MacMillian publisher I think (or maybe just by an author who has been
published by them).  Search the archives for mention of it.

I haven't made any distributeable packages yet so I don't have any
real-world experience to draw from.

HTH,
-D