tags:

views:

84

answers:

4

whenever i build python file to exe file from py2exe, it takes lots of space of minimum 25MB for small project also,it includes all the the python library file. Is there any other way that i can reduce the size.

A: 

No, not really; you need Python shipped with the exe so that it is standalone. It it not common to create exe Files from Python projects, anyway.

Florian Mayer
"not common" may be true of your computer. In any case it's irrelevant to the OP's question.
John Machin
I was talking about the Python developer community, that it is not common practice to use py2exe. That does matter.
Florian Mayer
+2  A: 

Python programs need python to run. All py2exe does is to include full python and all libraries you use together with your script in a single file.

nosklo
"""all libraries you use""" ... yeah, and often many libraries that you don't use -- see the reference given by @ghostdog74.
John Machin
+4  A: 

You should have read the documentation before using. Here's a page you can read

ghostdog74
thank you very much!!!..
A: 

py2exe tends to err on the side of caution. You can manually exclude some libraries with the exclude list option in order to reduce the size of the file.

In my experience, you should be able to compress down to a ~9 MB installer (Inno) if you include wxPython or another GUI framework, ~7 MB if you ship a console app or use tkinter.

Ryan Ginstrom
But then, why not install Python properly in the installation procedure, when you use an installer, and let py2exe be?
Florian Mayer
@Florian: Because the average Windows user is going to have a hard time installing Python in order to use your software. I've dealt with the problem many times. Even when they manage to install Python, getting them to navigate the command line is a challenge.
Ryan Ginstrom
You can make your installer install Python for them and link directly to the main .py file.
Florian Mayer
If you have a savvy user, then fine. But if your user doesn't know Python from a turnip (and most Windows users don't), then expecting them to handle the package management of a normal Python install is simply not realistic.
Ryan Ginstrom