22
This commit is contained in:
1 parent
05a7fff1f2
commit
d9a691ea9a
2 files changed
+25
-5
No files matched your search
@@ -55,10 +55,11 @@ factory_sliceing.exe begin_sliceing C:\work\data
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **依赖项**: 确保所有依赖已安装(redis, oss2, requests 等)
|
||||
2. **隐藏导入**: 如果运行时提示模块未找到,可以在 `build_exe.py` 中添加 `--hidden-import` 参数
|
||||
1. **依赖项**: 确保所有依赖已安装(redis, oss2, requests, uiautomation, pywin32 等)
|
||||
2. **隐藏导入**: 打包脚本已自动包含常见模块(uiautomation, win32gui 等),如果运行时仍提示模块未找到,可以在 `build_exe.py` 中添加 `--hidden-import` 参数
|
||||
3. **数据文件**: 如果项目需要配置文件或其他数据文件,需要添加 `--add-data` 参数
|
||||
4. **文件大小**: 打包后的 exe 文件可能较大(通常 50-200MB),这是正常的,因为包含了 Python 解释器和所有依赖
|
||||
5. **uiautomation**: 已自动包含在打包脚本中,使用 `--collect-all=uiautomation` 确保完整打包
|
||||
|
||||
## 故障排除
|
||||
|
||||
@@ -67,9 +68,11 @@ factory_sliceing.exe begin_sliceing C:\work\data
|
||||
- 尝试在命令行运行 exe 查看错误信息
|
||||
- 检查是否有隐藏导入的模块未添加
|
||||
|
||||
### 问题:模块未找到错误
|
||||
- 在 `build_exe.py` 中添加对应的 `--hidden-import` 参数
|
||||
- 或者使用 `--collect-all` 参数收集所有子模块
|
||||
### 问题:模块未找到错误(如 uiautomation)
|
||||
- **已修复**: `uiautomation` 模块已添加到打包脚本中
|
||||
- 如果遇到其他模块未找到,在 `build_exe.py` 中添加对应的 `--hidden-import` 参数
|
||||
- 或者使用 `--collect-all=<模块名>` 参数收集所有子模块
|
||||
- 常见问题模块:`uiautomation`, `win32gui`, `win32con`, `win32api`, `psutil`, `minio`
|
||||
|
||||
### 问题:文件过大
|
||||
- 这是正常的,PyInstaller 会打包 Python 解释器和所有依赖
|
||||
|
||||
@@ -41,6 +41,23 @@ def build_exe():
|
||||
'--hidden-import=auto_sliceing_operate.utils',
|
||||
'--hidden-import=download_batch_data.utils',
|
||||
|
||||
# UI 自动化相关模块
|
||||
'--hidden-import=uiautomation',
|
||||
|
||||
# Windows API 相关模块(pywin32)
|
||||
'--hidden-import=win32gui',
|
||||
'--hidden-import=win32con',
|
||||
'--hidden-import=win32api',
|
||||
'--hidden-import=win32process',
|
||||
|
||||
# 其他可能需要的模块
|
||||
'--hidden-import=psutil', # 进程管理(可选,但有 try-except)
|
||||
'--hidden-import=minio', # MinIO 客户端
|
||||
'--hidden-import=minio.error',
|
||||
|
||||
# 收集 uiautomation 的所有子模块(确保完整打包)
|
||||
'--collect-all=uiautomation',
|
||||
|
||||
# 添加数据文件(如果需要)
|
||||
# '--add-data=config;config', # Windows 格式
|
||||
# '--add-data=config:config', # Linux/Mac 格式
|
||||
|
||||
Reference in new issue
Block a user