[Tutor] (no subject)

Luke Paireepinart rabidpoobear at gmail.com
Sat Nov 25 07:10:39 CET 2006

Narasimha wrote:
> Is it possible to create stand-alone programs(like exe files in dos 
> and a.out files in UNIX) with Python?
> If possible please tell me how to make them.
> I am planning to distribute my python code to friends.
> They don’t have python interpreters nor they know how to use them.
> Please suggest a solution.
Depends how you want to distribute it.
It's not unreasonable for you to just include the whole python 
interpreter, along with a batch file that will run the script using the 
included interpreter,
on a CD.
IF you're going to make it available for download, though, you want to 
minimize the packages that are included.
A tool like py2exe does this. In addition to reducing the included 
packages to the bare minimum,
it also generates a nice .exe.
But really, you could get the same functionality with a simple batch 
script, and then it would work on Linux too.
Not the batch script, obviously, but the rest of your program.
Although I'm prettty sure most modern linux distros come with Python 
already installed, so you don't need to be concerned about those linux folk.
Except, I find that it's more trouble for linuxers to get packages for 
their python scripts, because they have to make-install etc. whereas 
windows people have a nice friendly,
fuzzy little GUI installer for the majority of python packages.
So including an interpreter on the CD With your program that has all of 
the dependencies built in may not be a bad idea.

On the other hand (assuming we have more than 2 hands by now)
you could also just teach them how to install files, and pat them gently 
on the back and say "congratulations!"

I mean, really, it's not any harder to install a python distribution 
than it is to install, say, Battlefield 2 or Microsoft Office.

Once it's installed, they just double-click the file the same as they 
would with any other program.
So their argument that they 'wouldn't know how to use it' doesn't really 
If they want to make their own programs, they can learn how to use it.
If they want to run your programs, it doesn't matter whether they 
understand it or not.
Just tell them not to look at the source code and they can go on 
thinking that all programs are made by magical
programming fairies while we sleep, or by little elves.

Oh, and to address your original question:
I don't think it's possible to have a single .exe with all your 
program's functionality contained within.
But you can have a .exe as well as a file directory that has all of your 
In this case, why not just have a batch and a python installation?
Just remember that very few programs come in completely enclosed .exes. 
Examples include Anim8or, and....
Hmm. I can't think of any others.
Anyway, that's enough out of me.
Time for you to get on with your pythoneering!
Hope I helped,

> ------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list