why pack
1. No need for users to download any packages themselves. You send the py program to others, and when others run it, they need to pip install a bunch of things in advance, and package them into exe to import dependencies.
2. It is convenient to find the program entrance. A bunch of main.py \ entry.py written by myself, laymen don't know which one to run. Find the exe after packaging.
What is the difference between auto-py-to-exe and pyinstaller?
For packaging, we can also use pyinstaller, which is a program packaged through the command line.
auto-py-to-exe is a GUI interface, no command line, easy to understand (in fact, it is translated into a command line for you), you can
see, and finally it is translated into a pyinstaller command to convert.
Steps
Anso auto-py-to-exe
pip install auto-py-to-exe
Enter the above code in cmd to install the auto-py-to-exe package
Enter auto-py-to-exe to open the packaging interface
Single file\single directory
- After the single directory is packaged, it is a directory with exe in it
- single file is an exe
console window
If your py program uses a windowed program such as tkinter, pyqt, etc., and does not need a black window (cmd), it can be set to "window-based". This way there is no cmd window.
icon
You can add an icon to the exe in ico format.
Additional Documents
The required dependencies and attachment files are added here.
Generate exe
Click the .py to .exe at the bottom to start generating, wait for a while, the output path defaults to the output folder under the same directory as the target program.
After opening, find the corresponding exe, double-click to open