docs(README): 更新PyInstaller打包说明并添加参数解释
添加详细的打包命令和参数说明,包括清理脚本和打包日志信息
This commit is contained in:
29
README.md
29
README.md
@@ -230,18 +230,37 @@ python main.py
|
|||||||
|
|
||||||
## 打包发布
|
## 打包发布
|
||||||
|
|
||||||
项目提供PyInstaller打包配置(build.spec),可将应用打包为独立可执行文件:
|
项目使用PyInstaller将应用打包为独立可执行文件:
|
||||||
|
|
||||||
|
### 打包命令
|
||||||
```bash
|
```bash
|
||||||
# 安装PyInstaller
|
# 安装PyInstaller
|
||||||
pip install pyinstaller
|
pip install pyinstaller
|
||||||
|
|
||||||
# 打包应用
|
# 打包应用(生成单个exe文件)
|
||||||
pyinstaller build.spec
|
pyinstaller --onefile --noconsole --icon=guba.ico --distpath=. --hidden-import=PySide6.Qt6Compat --exclude-module PyQt5 --exclude-module PyQt6 main.py
|
||||||
|
|
||||||
# 执行文件将在dist目录下生成
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 打包参数说明
|
||||||
|
- `--onefile`: 打包成单个exe文件
|
||||||
|
- `--noconsole`: 不显示控制台窗口
|
||||||
|
- `--icon=guba.ico`: 使用guba.ico作为程序图标
|
||||||
|
- `--distpath=.`: 在当前目录生成exe文件
|
||||||
|
- `--hidden-import=PySide6.Qt6Compat`: 显式导入PySide6兼容模块
|
||||||
|
- `--exclude-module PyQt5 --exclude-module PyQt6`: 排除其他Qt绑定,避免冲突
|
||||||
|
|
||||||
|
### 清理打包残留
|
||||||
|
打包完成后,可运行清理脚本删除build和dist文件夹:
|
||||||
|
```bash
|
||||||
|
python .trae/skills/pyinstaller-one/clean.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### 打包日志
|
||||||
|
打包命令已保存在 `package.log` 文件中,方便后续查阅和重复使用。
|
||||||
|
|
||||||
|
### 执行文件
|
||||||
|
打包完成后,`main.exe` 文件将在当前目录生成,可直接运行,无需安装Python环境。
|
||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
1. **API费用**: 使用大语言模型API可能产生费用,请注意控制调用频率
|
1. **API费用**: 使用大语言模型API可能产生费用,请注意控制调用频率
|
||||||
|
|||||||
Reference in New Issue
Block a user