How can I make an EXE file from a Python program?
Solution 1
Auto PY to EXE - A .py to .exe converter using a simple graphical interface built using Eel and PyInstaller in Python.
py2exe is probably what you want, but it only works on Windows.
PyInstaller works on Windows and Linux.
Py2app works on the Mac.
Solution 2
I found this presentation to be very helpfull.
How I Distribute Python applications on Windows - py2exe & InnoSetup
From the site:
There are many deployment options for Python code. I'll share what has worked well for me on Windows, packaging command line tools and services using py2exe and InnoSetup. I'll demonstrate a simple build script which creates windows binaries and an InnoSetup installer in one step. In addition, I'll go over common errors which come up when using py2exe and hints on troubleshooting them. This is a short talk, so there will be a follow-up Open Space session to share experience and help each other solve distribution problems.
Solution 3
Also known as Frozen Binaries but not the same as as the output of a true compiler- they run byte code through a virtual machine (PVM). Run the same as a compiled program just larger because the program is being compiled along with the PVM. Py2exe can freeze standalone programs that use the tkinter, PMW, wxPython, and PyGTK GUI libraties; programs that use the pygame game programming toolkit; win32com client programs; and more. The Stackless Python system is a standard CPython implementation variant that does not save state on the C language call stack. This makes Python more easy to port to small stack architectures, provides efficient multiprocessing options, and fosters novel programming structures such as coroutines. Other systems of study that are working on future development: Pyrex is working on the Cython system, the Parrot project, the PyPy is working on replacing the PVM altogether, and of course the founder of Python is working with Google to get Python to run 5 times faster than C with the Unladen Swallow project. In short, py2exe is the easiest and Cython is more efficient for now until these projects improve the Python Virtual Machine (PVM) for standalone files.
Solution 4
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
Solution 5
Not on the freehackers list is gui2exe which can be used to build standalone Windows executables, Linux applications and Mac OS application bundles and plugins starting from Python scripts.
Related videos on Youtube
minty
Updated on July 08, 2022Comments
-
minty almost 2 years
I've used several modules to make EXEs for Python, but I'm not sure if I'm doing it right.
How should I go about this, and why? Please base your answers on personal experience, and provide references where necessary.
-
lubos hasko over 15 years
-
Don Kirkby over 12 yearsSee this similar question.
-
Mohammad almost 8 years
-
Have a nice day about 3 yearsWhy is this question closed because it already has answers in questions that were asked after this one???
-
-
Fabio Zadrozny over 12 yearsI think cx_Freeze cx-freeze.sourceforge.net/cx_Freeze.html is a better alternative (cross platform).
-
TLSK about 11 yearsgui2exe has some problems if you use wxpython module utlis in windows OS.
-
svth almost 11 yearsPlatypus (Mac only) is also pretty good for making an app from Python scripts.
-
Ryan Pergent about 7 yearsPyInstaller was perfect, extremely simple and fast. py2exe wouldn't work on python 3.5 and didn't get all the modules in the .exe
-
Yster almost 7 yearsIt seems PyInstaller does not support Python 3.6 yet.
-
tiwarinitin94 about 6 yearsand py2exe doesn't support 3.2 , its asking for 2.7