From 2d4cd9356e9ea32537ff1d56f57d1c38928289e0 Mon Sep 17 00:00:00 2001 From: congsh Date: Thu, 12 Feb 2026 16:02:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20=E6=89=93?= =?UTF-8?q?=E5=8C=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 build.bat: 添加 UTF-8 编码设置 - 修复 spec 文件: 移除不存在的 config.yaml.template - 添加 README.md 作为数据文件 Co-Authored-By: Claude Opus 4.6 --- CutThenThink.spec | 4 ++-- build.bat | 33 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CutThenThink.spec b/CutThenThink.spec index db080ac..2499595 100644 --- a/CutThenThink.spec +++ b/CutThenThink.spec @@ -18,8 +18,8 @@ a = Analysis( pathex=[], binaries=[], datas=[ - # 包含配置文件模板 - ('config.yaml.template', '.'), + # 包含 README 作为说明 + ('README.md', '.'), ], hiddenimports=[ 'PyQt6.QtCore', diff --git a/build.bat b/build.bat index fc439c8..bd83078 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,10 @@ @echo off REM CutThenThink 极简版本 Windows 打包脚本 +REM 使用 UTF-8 编码避免乱码 + +chcp 65001 >nul + +setlocal enabledelayedexpansion echo =================================== echo CutThenThink v2.0 极简版构建 @@ -12,35 +17,39 @@ echo - 无重型依赖:torch, transformers, paddleocr echo =================================== echo. -REM [1/3] 清理旧的构建 -echo [1/3] 清理旧的构建... -if exist build rmdir /s /q build -if exist dist rmdir /s /q dist +REM [1/4] 清理旧的构建 +echo [1/4] 清理旧的构建... +if exist build rmdir /s /q build 2>nul +if exist dist rmdir /s /q dist 2>nul -REM [2/3] 安装构建依赖 +REM [2/4] 安装构建依赖 echo. -echo [2/3] 安装构建依赖... -pip install pyinstaller 2>NUL || echo PyInstaller 已安装 +echo [2/4] 安装构建依赖... +pip install pyinstaller 2>nul +if errorlevel 1 ( + echo 警告: pip install 失败,请检查网络连接 +) -REM [3/3] 构建可执行文件 echo. -echo [3/3] 构建可执行文件... +echo [3/4] 构建可执行文件... +echo. python -m PyInstaller CutThenThink.spec --clean if errorlevel 1 ( echo. + echo =================================== echo 构建失败! + echo =================================== pause exit /b 1 ) echo. echo =================================== -echo 构建完成! +echo 构建成功! echo =================================== echo. -echo 输出位置: -echo - dist\CutThenThink\ # 可执行文件目录 +echo 输出位置:dist\CutThenThink\ echo. echo 首次运行前请配置: echo 1. 可选安装 OCR:pip install -r requirements-ocr.txt