comparing alternatives to py2exe

Maxim Khitrov mkhitrov at gmail.com
Tue Nov 3 18:08:59 CET 2009


On Tue, Nov 3, 2009 at 10:58 AM, Jonathan Hartley <tartley at tartley.com> wrote:
> Hi,
>
> Recently I put together this incomplete comparison chart in an attempt
> to choose between the different alternatives to py2exe:
>
> http://spreadsheets.google.com/pub?key=tZ42hjaRunvkObFq0bKxVdg&output=html
>
> Columns represent methods of deploying to end-users such that they
> don't have to worry about installing Python, packages or other
> dependencies. 'Bundle' represents manually bundling an interpreter
> with your app. 'Bootstrap' represents a fanciful idea of mine to
> include an installer that downloads and installs an interpreter if
> necessary. This sounds fiddly, since it would have to install side-by-
> side with any existing interpreters of the wrong version, without
> breaking anything. Has anyone done this?

Maybe there is a way to use Portable Python for this, but I have no
experience with it.

> The remaining columns represent the projects out there I could find
> which would do the bundling for me.
>
> Are there major things I'm missing or misunderstanding?
>
> Perhaps folks on the list would care to rate (+1/-1) rows that they
> find important or unimportant, or suggest additional rows that would
> be important to them. Maybe an updated and complete version of this
> table would help people agree on what's important, and help the
> various projects to improve faster.
>
> Best regards,
>
>  Jonathan

Good work. Recently I played with cx_freeze and compared it to py2exe,
which I've been using for a while. Here are my findings:

1. I don't think cx_freeze supports single exe. I haven't even been
able to get it to append the generated library.zip file to the
executable using documented options. Other things like .pyd files
always seem to be separate. At the same time, singe executables
generated by py2exe do not always work. I have a program that works
fine on Windows XP, Vista, and 7 if it is built under XP. However, if
I build the exact same program under Windows 7, it no longer works on
Vista or XP. I'm sure it has something to do with SxS or other dll
issues.

2. For output directory structure, you are able to specify where to
put the generated executable and all of its dependencies with both
py2exe and cx_freeze. You cannot do things like put python26.dll in a
separate directory from the executable. Not sure if that is what you
are referring to.

3. py2exe does not support Python 3 (unfortunately).

4. Although cx_freeze does support optimization (-O), it's a bit
broken in that the __debug__ variable is always set to True. In other
words, the code is optimized and things like assert statements are not
executed, but conditional statements that check __debug__ == True are.
I know that py2exe does not have this problem, no experience with
other tools.

5. py2exe is capable of generating smaller executables than cx_freeze
because of the base executable size (18.5 KB vs 1.35 MB). This is
offset by the fact that py2exe saves many more standard library
components to library.zip by default. In a quick test I just ran, both
generated a package of 4.03 MB, but I can remove at least a meg from
py2exe's library.zip. Rather than "distribution size", I think it
makes more sense to show "overhead" above the required components
(exclude minimal library.zip, python dll, and pyd files).

6. cx_freeze is as easy to use as py2exe after looking at the bundled examples.

- Max



More information about the Python-list mailing list