PyInstaller Python library source files can be packed under Windows, Linux, MacOS X and other operating systems into an executable file. By packing the source file, the program can run Python Python is not installed in the environment, or as a separate file to facilitate transfer and management. You can use the tool to install pip PyInstaller library. PyInstaller different packages for different operating systems generate executable file.
More introduction please visit http://www.pyinstaller.org
1, PyInstaller using the library method:
Commands commonly used parameters PyInstaller
parameter |
Features |
-h,--help |
View Help |
--clean |
Clean up temporary files in the packaging process |
-D, - onedir |
The default value is generated dist directory |
-F,--onefile |
In the dist only generate a separate package file folder |
-i < icon file name .ico> |
Specify an icon file packing program used |
2 , for example:
(1), .py code first executed to have
(2), win + R input interface DOS open cmd
Method Format: Pyinstaller + -F file path to be packaged
Input Pyinstaller -FC: \ Users \ admin \ self Python \ after two \ first.py Enter
当运行结束后,出现successfully表明打包成功,Appending archive to EXE C:\Users\admin\dist\first.exe表明文件打包生成的.exe文件储存路径
打开可执行文件
运行结果