pyinstaller
pyinstaller是一个python打包工具,生成一个可执行文件
pip install pyinstaller #安装pyinstaller pyinstaller -h #查看相关参数说明 -F, --onefile Create a one-file bundled executable. -n NAME, --name NAME Name to assign to the bundled app and spec file (default: first script's basename)
举例
需要打包的源文件
#test.py import time print("hello world!") time.sleep(3) print("Finish!")
pyinstaller -F test.py -n mytest #生成一个可执行文件,指定名字为mytest
生成可执行文件mytest.exe 双击即可执行(在其它电脑上也可以执行)
#python打包,取消启动console窗口 pyinstaller -F test.py -n mytest --noconsole

浙公网安备 33010602011771号