# 1. What is auto-py-to-exe

Auto-py-to-exe is a graphical tool for packaging Python programs into executable files. This article focuses on using auto-py-to-exe to package Python programs. Auto-py-to-exe is based on PyInstaller. Compared with PyInstaller, it has more GUI interface and is easier and more convenient to use

# 2. Install auto-py-to-exe

PIP install auto-py-to-exe: PIP install auto-py-to-exe: PIP install auto-py-to-exe: PIP install auto-py-to-exe After the installation is complete, we can start the auto-py-to-exe program by entering CMD: auto-py-to-exe.

Auto-py-to-exe is installed successfully.

# 3. The auto-py-to-exe option is introduced

There are many configuration options to specify when packaging Python programs using auto-py-to-exe, and it is important to know exactly what these options do. I’ll cover some of the important options below.

(1) Script Location

Script Location basically specifies the Python file we want to package

(2) Onefile

Onefile has two options: One Directory and One File

  • If you select One Directory, the package will be presented as a folder
  • If you select One File, you will have an.exe File when the program is packaged

(3) Console Window

The Console Window sets whether the Console appears when the wrapper is running

  • Console Based: Displays a Console interface when the packaged application is running
  • Window Based (hide the console) : Hides the console interface, mainly used to package Python programs with GUI

(4) Icon

An icon used to specify a wrapper

# 4. Auto-py-to-exe combat

This section mainly uses a calculator program to show how to package the program using auto-py-to-exe.

Auto-py-to-exe packaging program is mainly divided into three parts, respectively:

  • Open the auto – py – to – exe
  • Configure packaging options
  • View the packaging effect

1. Open the auto – py – to – exe

Open CMD and type: auto-py-to-exe. After opening auto-py-to-exe, we will make the configuration selection.

2. Configure packaging options

Calculator program, you can go to GitHub to download, address is: github.com/pythonprogr…

When packaging, the main configurations we need to carry out are:

  • Script Location
  • Onefile
  • Console Window

Script Location Selects the main program of the program. In the calculator project, we chose main.py

Onefile selects One File because a File looks compact

Since the calculator project has a GUI, select Window Based (hide the Console) for Console Window.

Icon Select an ICO file, this operation is not required, you can not set

If the application has its own module, we must add the module’s directory to Additional Files. Otherwise, Failed to execute script XXX is displayed

In the calculator program all our modules are in the calculation directory, so we need to add the calculation path to the Additional Files

Click the convert.py to.exe button when the configuration is complete

So we’re done packing a calculator project.

3. Check the packing effect

Once the program is packaged, we can click the OPEN OUTPUT FOLDER button, which opens the path to the packaged files.

In the package directory, we can see a main.exe file, which is our package file.

Click main.exe to see a calculator program.

At this point, the packaging work is successfully completed.

# 5. To sum up

This article focuses on using auto-py-to-exe to package Python programs. But this is just the simplest python package. If you want to package complex programs, the above configuration will not work.

Python is a very diverse and well-developed language, so there are definitely a lot of features THAT I haven’t considered, so if you know of any, let me know in the comments section