We still use pip to install first:
pipinstallPyInstaller
After the installation is complete, open the command line directly and enter pyinstaller. If the following interface is displayed, the installation is successful.
Then we can encapsulate our small program.
pyinstaller-F-wsome.py
- The meaning of F and -w:
- F: Pack all the content into an exe executable file, without other weird little dependent files.
- w: When running the generated exe file, the command line window will not pop up, we can only write the window ourselves otherwise it will not run.
After running, a dist folder will pop up on the desktop, and then there is an exe file inside. Double-click it.
Content expansion:
**How to generate executable .exe or APP from a compiled python program? **
First confirm the installation of pyinstaller and py2app, the installation method:
pipinstall pyinstaller
pip install py2app
cmd enters the command line of the Windows window, cd enters the root directory where the project is located, and then starts to generate the application.
Windows program generation:
pyinstaller-F -w testdata.py()
In pyinstaller and .py file name, you can enter the following command to specify the output configuration function as follows: