综合练习:打包成绩查询小工具

70.10 综合练习:打包成绩查询小工具

把 MySQL/SQLite 命令行小工具或 tkinter 界面程序打成 exe。

步骤:1. 本机运行正常 2. pyinstaller -F -w -n ScoreTool main.py 3. 在 dist 测试 4. 拷贝 exe 到其他电脑。

推荐打包流程

结合 MySQL 章节,把查询程序打包发给同学使用。

# 1. 确认运行
python main.py

# 2. 打包(GUI 示例)
pyinstaller --onefile --noconsole -n ScoreTool main.py

# 3. 测试
dist\ScoreTool.exe

# 4. 若缺 pymysql:
pyinstaller --onefile --noconsole --hidden-import=pymysql -n ScoreTool main.py