From 4b406a3727939828b5dc26f5ce756efb853d9be2 Mon Sep 17 00:00:00 2001 From: xiaji Date: Wed, 21 Jan 2026 09:08:29 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改build.spec中的路径处理逻辑,使用sys.argv[0]获取当前目录 - 移除PySide6.Qt6Compat的隐藏导入 - 新增build_new.bat打包脚本,包含依赖安装和清理流程 --- build_new.bat | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 build_new.bat diff --git a/build_new.bat b/build_new.bat new file mode 100644 index 0000000..fc1507d --- /dev/null +++ b/build_new.bat @@ -0,0 +1,48 @@ +@echo off +chcp 65001 >nul +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 ( + echo 正在安装 pyinstaller... + pip install pyinstaller +) + +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 + +echo 开始打包... +pyinstaller build.spec --noconfirm + +if exist "dist\guba-indicator\guba-indicator.exe" ( + echo ======================================== + echo 打包成功! + 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 打包失败,请检查错误信息 +) + +pause \ No newline at end of file