Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the exe process that Python programs are packaged into executable files

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "Python program packaged into executable file exe process is what", the article explained the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Python program packaged into executable file exe process is what" it!

1. What is auto-py-to-exe

Auto-py-to-exe is a graphical tool for packaging Python programs into executable files. This article mainly introduces how to use auto-py-to-exe to complete the packaging of python programs. Auto-py-to-exe is based on pyinstaller. Compared with pyinstaller, it has more GUI interface and is more simple and convenient to use.

2. Install auto-py-to-exe

First of all, we need to make sure that our python environment is greater than or equal to 2.7. then type: pip install auto-py-to-exe in cmd, and after the input is complete, pip will install the auto-py-to-exe package. After the installation is complete, we can start the auto-py-to-exe program by typing: auto-py-to-exe in cmd.

When the above picture appears, auto-py-to-exe will be installed successfully.

3. Introduction to some options of auto-py-to-exe

When using auto-py-to-exe to package python programs, there are many configuration options that we need to specify, and it is important to know exactly what these options do. I will introduce some of these important options below.

(1) Script Location

Script Location mainly specifies the python file that we want to package.

(2) Onefile

There are two options under Onefile: One Directory and One File

If you choose One Directory, then the package will be presented in the form of a folder

If you choose One File, there will be a .exe file after the program is packaged.

(3) Console Window

Console Window mainly sets whether the console appears when the packaging program is running

Console Based: a console interface is displayed when the packaged program is running

Window Based (hide the console): hides the console interface and is mainly used for packaging python programs with GUI

(4) Icon

The icon used to specify the packager

4. Auto-py-to-exe actual combat

This section focuses on a calculator program that describes how to package programs using auto-py-to-exe.

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

Open auto-py-to-exe

Configure Packaging option

View the package effect

1. Open auto-py-to-exe

Open cmd, type: auto-py-to-exe after opening auto-py-to-exe, we are about to make a configuration choice.

two。 Configure Packaging option

Calculator program, you can go to GitHub to download the address: https://github.com/pythonprogrammingbook/simple_calculator

When packaging, the main configurations we need to do are:

Script Location

Onefile

Console Window

Script Location chooses the main program of the program. In the calculator project, we choose main.py.

Onefile chose One File because a file looks concise

Because the calculator project comes with GUI, Console Window chooses Window Based (hide the console)

Icon Select an ico file. You don't have to operate it here, and you don't have to set it.

If the program has its own module, we must add the module directory to the Additional Files. Otherwise, a Failed to execute script XXX error will occur.

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.

In this way we can complete the packaging of a calculator project.

5. Check the packaging effect

After the program is packaged, we can click the OPEN OUTPUT FOLDER button and then open the path to the packaged file.

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

Click main.exe and you can see a calculator program.

Thank you for reading, the above is "what is the Python program packaged into an executable file exe process?" after the study of this article, I believe you have a deeper understanding of what the Python program packaged into an executable file exe process is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report