From a2d731e91b3045e46c3dc049abf84f4e7d729a14 Mon Sep 17 00:00:00 2001 From: congsh Date: Thu, 12 Feb 2026 10:29:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DWindows=E6=89=93?= =?UTF-8?q?=E5=8C=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化build.bat,使用Python命令直接打包 - 移除导致错误的^续行符 Co-Authored-By: Claude Opus 4.6 --- build.bat | 62 +++++-------------------------------------------------- 1 file changed, 5 insertions(+), 57 deletions(-) diff --git a/build.bat b/build.bat index 6b042e8..b397d16 100644 --- a/build.bat +++ b/build.bat @@ -1,69 +1,17 @@ @echo off +REM ================================ REM CutThenThink Windows 打包脚本 - -echo ================================ -echo CutThenThink 打包脚本 (Windows) -echo ================================ -echo. - -REM 检查 Python -python --version 2>nul || ( - echo 错误: 未找到 Python - pause - exit /b 1 -) - -REM 检查 PyInstaller -python -m PyInstaller --version 2>nul -if errorlevel 1 ( - echo. - echo 正在安装 PyInstaller... - echo. - python -m pip install --user pyinstaller -) - -echo. -echo 1/5. 安装项目依赖... -echo. -python -m pip install --user --upgrade pip 2>nul -python -m pip install --user -r requirements.txt 2>nul - -echo. -echo 2/5. 创建轻量版打包(不包含PaddleOCR) -echo. -echo 说明: PaddleOCR体积很大(~200MB),首次运行时自动下载安装 -echo. - -REM 创建临时 requirements(不含OCR) -findstr /V "paddleocr" /V "paddlepaddle" requirements.txt > requirements_lite.txt - -REM 打包(轻量版) -echo 3/5. 开始打包(轻量版)... -python -m PyInstaller ^ - --name "CutThenThink" ^ - --windowed ^ - --onefile ^ - --add-data "src:src" ^ - --hidden-import=PyQt6.QtCore ^ - --hidden-import=PyQt6.QtGui ^ - --hidden-import=PyQt6.QtWidgets ^ - --hidden-import=sqlalchemy ^ - src/main.py - +REM ================================ +REM 使用 Python 打包,避免路径问题 +cd /d "%~dp0" +python -m PyInstaller --noconfirm --name "CutThenThink" --windowed --onefile --add-data "src:src" --hidden-import=PyQt6.QtCore --hidden-import=PyQt6.QtGui --hidden-import=PyQt6.QtWidgets --hidden-import=sqlalchemy src/main.py if errorlevel 1 ( echo 打包失败! pause exit /b 1 ) - -echo. echo ================================ echo 打包完成! echo 可执行文件: dist\CutThenThink.exe -echo 文件大小(不含OCR): 约 30-50 MB -echo ================================ echo. -echo 首次运行时,应用会自动下载并安装 PaddleOCR -echo. - pause