[Tutor] (no subject)

alan.gauld@bt.com alan.gauld@bt.com
Tue Dec 10 13:02:01 2002


> asked, but I'll do...<BR>I'm using Win98. How can I compile 
> Python-code to an executable (*.exe)? 

Its possible but IMHO not something you want to do if you 
can avoid it. It basically involved wrapping the python 
interpreter up with all the liraries you need into one big file. 
It won't run any faster and won'ty be much smaller. And it won't 
be much easier to  distribute.

The only advantage, and spurious at that, is that people 
can't see your code!

The big disadvantage is that if you want to distribute 
several python programs you wind up distrinbuting several 
copies of the python interpreter.

Better to do as HP and others do, create an installer that 
checks if Python is already installed (check the registry 
then the filesystem) and if not run the standard Python 
installer followed by dumping your files into a suitable 
place. Finally update the PYTHONPATH in autoexec.bat or the 
sys.path if you prefer.

One copy of python and you can get the benefit of upgrades
later if needed.

If you really must bundle to exe then look at py2exe
(A Google search will find it)

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld