pyinstaller package
specific process
1. Install pyinstaller
pip install pyinstaller
2. Packaging command
2.1. When the packaging object is relatively large
pyinstaller -D -i 1.ico -c -n Z_PID Main.py
Inside the main py directory of the final generated file:
Here is an explanation:
- 1. ico needs to be prepared by yourself,
- -n is the name given to the main program,
- Main.py is the main py,
- -D means that the packaged file is not an independent exe. It is recommended to do this. Of course, it can be changed to -F and packaged as an independent exe execution file. It is difficult to start like this, especially when a package is about 6G . If an external file is called, it must be placed in the same directory as the exe.
2.2. When the packaging object is not very large
pyinstaller -F main.py -n xxx
illustrate:
- After packaging, it is a stand-alone executable file
- The directory where the package file is located is the dist directory under the main project directory