How to Use auto-py-to-exe to Package Python Programs into Executables
auto-py-to-exe is a GUI front‑end for PyInstaller that simplifies packaging Python scripts into standalone executables; this guide explains installation, key configuration options such as script location, one‑file mode, console window, icon, additional files, and demonstrates a complete example by packaging a simple calculator program.
auto-py-to-exe is a graphical tool built on PyInstaller that simplifies turning Python scripts into standalone executable files.
1. Installation : Ensure your Python version is 2.7 or higher, then run pip install auto-py-to-exe in the command prompt. After installation, launch the tool with auto-py-to-exe .
2. Key Options Overview
Script Location : Specify the Python file to be packaged (e.g., main.py ).
Onefile : Choose between One Directory (outputs a folder) or One File (outputs a single .exe ).
Console Window : Decide whether a console appears at runtime. Options are Console Based (shows console) or Window Based (hide the console) for GUI applications.
Icon : Optionally set an .ico file as the executable’s icon.
Additional Files : Add any extra modules or resource directories (e.g., a calculation folder) to avoid "Failed to execute script" errors.
3. Practical Example – Packaging a Calculator
The example uses a simple calculator project from GitHub ( https://github.com/pythonprogrammingbook/simple_calculator ). The steps are:
Open the command prompt and run auto-py-to-exe .
Select main.py as the script location.
Choose One File for a single executable.
Set Window Based (hide the console) because the program has a GUI.
Optionally assign an icon (not required).
Add the calculation directory to Additional Files so all modules are included.
Click the CONVERT .PY TO .EXE button to start packaging.
After conversion, click OPEN OUTPUT FOLDER to view the generated main.exe . Running this executable launches the calculator program.
4. Summary
This article demonstrated the basic workflow for using auto-py-to-exe to package a simple Python GUI application. For more complex projects, additional configuration may be required, and studying PyInstaller’s documentation is recommended for deeper understanding.
For further learning, refer to the official PyInstaller documentation.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.