TorqueWrench/frontend/快速打包指南.txt

88 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

========================================
wrench_gui.py 快速打包指南
========================================
【Windows 系统】
1. 打开命令提示符CMD或 PowerShell
2. 进入 frontend 目录:
cd F:\PyPro\TorqueWrench\frontend
3. 执行打包脚本:
build_exe.bat
4. 等待打包完成(约 1-3 分钟)
5. 打包完成后,可执行文件在:
dist\wrench_gui\wrench_gui.exe
6. 复制配置文件:
copy ..\config.json dist\wrench_gui\config.json
7. 运行程序:
dist\wrench_gui\wrench_gui.exe
【Linux/Mac 系统】
1. 打开终端
2. 进入 frontend 目录:
cd /path/to/TorqueWrench/frontend
3. 给脚本添加执行权限:
chmod +x build_exe.sh
4. 执行打包脚本:
./build_exe.sh
5. 等待打包完成(约 1-3 分钟)
6. 打包完成后,可执行文件在:
dist/wrench_gui/wrench_gui
7. 复制配置文件:
cp ../config.json dist/wrench_gui/config.json
8. 运行程序:
./dist/wrench_gui/wrench_gui
【注意事项】
1. 首次打包前,确保已安装 PyInstaller
pip install pyinstaller
2. 确保已安装所有依赖:
pip install -r requirements.txt
3. 打包前确保后端服务可以正常启动
4. 打包后的程序需要 config.json 配置文件才能运行
5. 如果打包失败,查看错误信息,通常是缺少依赖包
【常见问题】
Q: 打包失败,提示找不到模块?
A: 检查是否已安装所有依赖pip install -r requirements.txt
Q: 打包后的程序无法启动?
A: 确保 config.json 在可执行文件同一目录下
Q: 打包后的程序很大?
A: 这是正常的PyInstaller 会打包所有依赖,通常 15-30MB
Q: 如何减小打包后的文件大小?
A: 使用虚拟环境,只安装必需的包,或在 spec 文件中排除不需要的模块
【技术支持】
详细说明请查看:打包说明.md