打包python为可执行文件
PyInstaller
PyInstaller is a program that freezes (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.4—3.7, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
1.install
1 | pip3 install pyinstaller |
2.Go to your program’s directory and run
1 | pyinstaller myscript.py |
This will generate the bundle in a subdirectory called dist.
PyInstaller analyzes myscript.py and:
- Writes myscript.spec in the same folder as the script.
- Creates a folder build in the same folder as the script if it does not exist.
- Writes some log files and working files in the build folder.
- Creates a folder dist in the same folder as the script if it does not exist.
- Writes the myscript executable folder in the dist folder.
In the dist folder you find the bundled app you distribute to your users.
What to generate:
1 | -D |
more info:
pyinstaller manual
本文标题:打包python为可执行文件
文章作者:Mr Bluyee
发布时间:2018-12-12
最后更新:2019-07-15
版权声明:The author owns the copyright, please indicate the source reproduced.