1

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.

4 Answers 4

6

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

Sign up to request clarification or add additional context in comments.

Comments

3

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.

1 Comment

"""all libraries you use""" ... yeah, and often many libraries that you don't use -- see the reference given by @ghostdog74.
0

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.

4 Comments

But then, why not install Python properly in the installation procedure, when you use an installer, and let py2exe be?
@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.
You can make your installer install Python for them and link directly to the main .py file.
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.
-2

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.

2 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.