# Python程序打包命令示例 # 使用PyInstaller进行打包 # 安装PyInstaller # pip install pyinstaller # 基础打包命令 # pyinstaller your_script.py # 打包为单个可执行文件 # pyinstaller --onefile your_script.py # 打包为单个可执行文件并隐藏控制台窗口(适用于GUI程序) # pyinstaller --onefile --windowed your_script.py # 指定输出文件名 # pyinstaller --onefile --name MyApp your_script.py # 添加图标 # pyinstaller --onefile --icon=app.ico your_script.py # 添加数据文件 # pyinstaller --onefile --add-data="data;data" your_script.py # 排除不需要的模块 # pyinstaller --onefile --exclude-module matplotlib your_script.py # 清理旧的打包文件 # pyinstaller --clean your_script.py # 使用spec文件进行更复杂的配置 # pyinstaller your_script.spec
本文为宁若水!原创文章,转载无需和我联系,但请注明来自[若水]博客 www.lalaya.net
