fix(打包): 改进打包脚本和Playwright浏览器路径处理

- 更新build.bat添加依赖检查和清理步骤
- 修改build.spec配置以正确处理Playwright依赖
- 增强SpiderManager中Playwright路径的查找逻辑
- 添加错误处理和调试信息
This commit is contained in:
2026-01-20 15:11:03 +08:00
parent f23feaf140
commit 346d4a7c99
5 changed files with 106 additions and 22 deletions

View File

@@ -3,6 +3,14 @@ echo ========================================
echo 股吧人气指示器 - 打包工具
echo ========================================
REM 检查并安装必要的依赖
echo 检查并安装依赖...
pip install -r requirements.txt
REM 安装Playwright浏览器
echo 安装Playwright浏览器...
python -m playwright install chromium
REM 检查 pyinstaller 是否安装
pip show pyinstaller >nul 2>&1
if errorlevel 1 (
@@ -10,14 +18,28 @@ if errorlevel 1 (
pip install pyinstaller
)
echo 开始打包...
pyinstaller build.spec
REM 清理旧的构建文件
echo 清理旧的构建文件...
if exist "build" rmdir /s /q build
if exist "dist" rmdir /s /q dist
if exist "guba-indicator.spec" del guba-indicator.spec
if exist "dist\guba-indicator.exe" (
echo 开始打包...
pyinstaller build.spec --noconfirm
if exist "dist\guba-indicator\guba-indicator.exe" (
echo ========================================
echo 打包成功!
echo 可执行文件位置: dist\guba-indicator.exe
echo 可执行文件位置: dist\guba-indicator\guba-indicator.exe
echo ========================================
REM 复制必要的资源文件
echo 复制资源文件...
copy guba.ico dist\guba-indicator\ >nul 2>&1
copy indicator.ico dist\guba-indicator\ >nul 2>&1
copy config.json dist\guba-indicator\ >nul 2>&1
echo 资源文件复制完成!
) else (
echo 打包失败,请检查错误信息
)