Files
cutThenThink/build.bat
congsh 154d53dbfd feat: 添加轻量打包和OCR自动安装功能
- 添加Windows打包脚本 build.bat
- 更新打包文档 BUILD.md(轻量版方案)
- OCR模块:添加首次运行时自动安装PaddleOCR的功能
- 主窗口:添加OCR安装检测和提示逻辑
- 创建应用入口 src/main.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 10:14:10 +08:00

70 lines
1.5 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
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
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