Article Directory
foreword
This article mainly introduces the use of auto-py-to-exe to package py scripts into exe files. auto-py-to-exe is packaged based on pyinstaller, and the graphical interface is simple and clear. After setting the packaging information, one-click to complete the packaging of the py script.
One, auto-py-to-exe installation
Enter "auto-py-exe" on the command line to install, and wait for the installation to complete. When the installation is successful, the words "successfully installed" will be displayed.
pip install auto-py-to-exe
2. Package the py script into an exe step
1. Prepare the py script that needs to be packaged
I wrote a simple py script here as a demonstration. If you don't have a friend who has written a script, you can use my script to learn. The content of the script is very simple. It prints "I am a handsome guy" 5 times, and finally sets an input to view the results when running the exe. The code example is as follows:
print('我是帅哥')
print('我是帅哥')
print('我是帅哥')
print('我是帅哥')
print('我是帅哥')
de = input('输出测试')
2. 启动auto-py-to-exe
Enter auto-py-to-exe in the cmd window to start. After the startup is successful, you will enter the following interface:
If the English version is not used to some students, you can select "Chinese Simplified (Simplified Chinese)" in the Language column, and the page will be into a Chinese version.
3. Configure packaging settings
First, in the "Script Location" column, click [Browse] to select the script to be packaged.
Secondly, in the "Single File" column, select the type of file to be generated after packaging. If you select [Single Directory], a directory will be generated after successful packaging, which contains dependencies and exe files. If [Single File] is selected, a single exe file will be generated after successful packaging.
Again, in the "Console Type" column, select [Console-based] or [Window-based]. Generally, py scripts choose [Console-based], and window-based scripts are used for scripts with gui windows.
Again, in the "Icon" column, click [Path] to select the ico icon file.
Again, in the "Settings" column, click [auto-py-to-exe] [Output Path] - [Browse] to select the location to save the exe file.
Finally, slide to the last column of the page, click [Convert .PY to .EXE], and wait for the operation to complete
4. Run the .exe file
Enter the directory where the exe is located, and double-click the .exe file to run it successfully.
Summarize
This article mainly introduces the use of auto-py-to-exe to package py scripts into exe files. If there is anything wrong, welcome to point it out, and hope that the big guys will give you some advice.