Python executables?
Bruno Desthuilliers
bdesth.nospam at removeme.free.fr
Thu Jun 26 09:54:27 EDT 2003
Catalin wrote:
> How can I make executables with python?
> I found some utilities that claim they can do something like that like
> Installer and py2exe but they actualy pack the code in a huge arhive!
> This solves the problem of giving python programs to users who don't
> have python but doesn't solve the problem of the source "secrecy"
> (copyright).
> And the programs also run much slower and become extremely big compared
> to a normal C++ program for example. I made a test and a 2 programs
> doing the same thing where 400 KB with C Builder (static linked) and
> 2.80 MB with python+installer in an arhive packed with upx and 6.9 MB
> with py2exe(unpacked). And the speed difference was huge.
> So can a python program become a "real" executable(I am refering both to
> windows and unix platforms)?
> If this is imposible with python is it possible with jpython?
>
Here you expose 3 different problems :
1/ source "secrecy" (copyright) :
It's the wrong problem. *Any* binary code can be subject to
reverse-engineering. There are even tools to do this quite easily for
Java. The right way to protect your property is via copyright and licence.
2/ Size of "packed" programs :
Realize that the pack must include the whole Python interpreter and
librairies. BTW, I personnaly never used such tools, but I think I
remember that some of them allow you to specify which parts you really need.
3/ 'Slowness' :
I don't believe that 'packing' the program makes it slower.
Are you sure your Python code is really Pythonic ? There are tips and
tricks in how to 'optimize' Python code, and it can be very different
from low-level (C/C++ etc) languages techniques. You may want to have a
look at :
http://manatee.mojam.com/~skip/python/fastpython.html
Now if you really need smallest possible footprint and blazing-fast
execution speed (which are antagonist needs anyway), and your program is
about low-level stuff, you may not have choosen the right tool !-)
Bruno
More information about the Python-list
mailing list