How to Package Python Scripts into Executables with auto-py-to-exe
This guide explains what auto-py-to-exe is, how to install it, introduces its key options, and walks through a step‑by‑step example of packaging a simple calculator Python program into a standalone executable.
1. What is auto-py-to-exe
auto-py-to-exe is a graphical tool for converting Python programs into executable files. It is built on top of PyInstaller and adds a user‑friendly GUI, making the packaging process simpler.
2. Installing auto-py-to-exe
First ensure your Python version is 2.7 or higher. Then run pip install auto-py-to-exe in the command prompt. After installation, start the program by typing auto-py-to-exe.
The image above indicates that auto-py-to-exe has been installed successfully.
3. Overview of auto-py-to-exe Options
When using auto-py-to-exe, several configuration options must be set correctly.
(1) Script Location – specifies the Python file to be packaged.
(2) Onefile – offers two choices: One Directory (produces a folder) and One File (produces a single .exe).
If One Directory is selected, the output appears as a folder.
If One File is selected, the output is a single .exe file.
(3) Console Window – determines whether a console appears when the program runs.
Console Based: shows a console window.
Window Based (hide the console): hides the console, suitable for GUI applications.
(4) Icon – optional setting to specify an icon for the executable.
4. Practical Example: Packaging a Calculator
This section demonstrates packaging a simple calculator program.
The process consists of three steps:
Open auto-py-to-exe.
Configure packaging options.
View the resulting executable.
1. Open auto-py-to-exe
Run auto-py-to-exe from the command line to launch the GUI.
2. Configure Packaging Options
Download the calculator source from GitHub . The required settings are:
Script Location – select main.py.
Onefile – choose One File for a single executable.
Console Window – select Window Based (hide the console) because the calculator has a GUI.
Icon – optional; can be left unset.
If the program includes additional modules, add their directories to Additional Files to avoid “Failed to execute script” errors.
After configuration, click the CONVERT .PY TO .EXE button.
3. View the Packaging Result
Click OPEN OUTPUT FOLDER to open the directory containing the generated files.
In the output folder you will see main.exe. Running this file launches the calculator program.
5. Summary
This article introduced how to use auto-py-to-exe to package Python programs, covering installation, key options, and a concrete example. For more complex projects, additional configuration may be required, and studying PyInstaller directly can provide deeper insights.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
