2026-02-12 10:14:10 +08:00
|
|
|
@echo off
|
2026-02-12 10:29:01 +08:00
|
|
|
REM ================================
|
2026-02-12 10:31:01 +08:00
|
|
|
REM CutThenThink Windows Build Script
|
2026-02-12 10:29:01 +08:00
|
|
|
REM ================================
|
2026-02-12 10:31:01 +08:00
|
|
|
|
2026-02-12 10:32:31 +08:00
|
|
|
REM Change to project directory
|
2026-02-12 10:29:01 +08:00
|
|
|
cd /d "%~dp0"
|
2026-02-12 10:31:01 +08:00
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
REM Check Python
|
2026-02-12 10:38:44 +08:00
|
|
|
echo Checking Python...
|
2026-02-12 10:32:31 +08:00
|
|
|
python --version 2>nul
|
|
|
|
|
if errorlevel 1 (
|
2026-02-12 10:38:44 +08:00
|
|
|
echo Python not found. Please install Python 3.8+
|
2026-02-12 10:32:31 +08:00
|
|
|
pause
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
REM Get Python version
|
|
|
|
|
for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYVER=%%i
|
|
|
|
|
echo Detected Python %PYVER%
|
2026-02-12 10:32:31 +08:00
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
echo.
|
|
|
|
|
echo 1/5. Installing PyInstaller...
|
|
|
|
|
python -m pip install --user pyinstaller 2>nul
|
2026-02-12 10:38:44 +08:00
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
echo.
|
|
|
|
|
echo 2/5. Installing dependencies (compatible with Python 3.13)...
|
|
|
|
|
REM Use SQLAlchemy 2.0.36+ for Python 3.13 compatibility
|
|
|
|
|
python -m pip install --user "sqlalchemy>=2.0.36" 2>nul
|
|
|
|
|
python -m pip install --user "PyQt6>=6.7.0" 2>nul
|
2026-02-12 10:32:31 +08:00
|
|
|
python -m pip install --user pyyaml 2>nul
|
|
|
|
|
python -m pip install --user requests 2>nul
|
|
|
|
|
python -m pip install --user pillow 2>nul
|
|
|
|
|
python -m pip install --user pyperclip 2>nul
|
|
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
REM Install build dependencies
|
|
|
|
|
python -m pip install --user setuptools 2>nul
|
|
|
|
|
|
2026-02-12 10:32:31 +08:00
|
|
|
echo.
|
2026-02-12 10:41:27 +08:00
|
|
|
echo 3/5. Cleaning previous build...
|
|
|
|
|
if exist build rmdir /s /q build
|
|
|
|
|
if exist dist rmdir /s /q dist
|
|
|
|
|
|
|
|
|
|
echo.
|
|
|
|
|
echo 4/5. Building executable...
|
|
|
|
|
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 ^
|
2026-02-12 11:25:14 +08:00
|
|
|
--hidden-import=sqlalchemy.orm ^
|
2026-02-12 11:14:06 +08:00
|
|
|
--hidden-import=PIL ^
|
|
|
|
|
--hidden-import=PIL.Image ^
|
|
|
|
|
--hidden-import=PIL.ImageEnhance ^
|
|
|
|
|
--hidden-import=PIL.ImageFilter ^
|
|
|
|
|
--hidden-import=numpy ^
|
|
|
|
|
--hidden-import=pyperclip ^
|
2026-02-12 11:25:14 +08:00
|
|
|
--hidden-import=tkinter ^
|
|
|
|
|
--hidden-import=tkinter.ttk ^
|
|
|
|
|
--hidden-import=tkinter.scrolledtext ^
|
|
|
|
|
--hidden-import=tkinter.messagebox ^
|
|
|
|
|
--hidden-import=yaml ^
|
|
|
|
|
--hidden-import=requests ^
|
2026-02-12 11:14:06 +08:00
|
|
|
--collect-all pyqt6 ^
|
2026-02-12 10:41:27 +08:00
|
|
|
src/main.py
|
|
|
|
|
|
2026-02-12 10:14:10 +08:00
|
|
|
if errorlevel 1 (
|
2026-02-12 10:41:27 +08:00
|
|
|
echo.
|
|
|
|
|
echo ================================
|
2026-02-12 10:31:01 +08:00
|
|
|
echo Build Failed!
|
2026-02-12 10:41:27 +08:00
|
|
|
echo ================================
|
2026-02-12 10:14:10 +08:00
|
|
|
pause
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
2026-02-12 10:31:01 +08:00
|
|
|
|
2026-02-12 10:41:27 +08:00
|
|
|
echo.
|
2026-02-12 10:14:10 +08:00
|
|
|
echo ================================
|
2026-02-12 10:31:01 +08:00
|
|
|
echo Build Complete!
|
|
|
|
|
echo Executable: dist\CutThenThink.exe
|
2026-02-12 10:41:27 +08:00
|
|
|
echo File size: ~30-50 MB
|
2026-02-12 10:31:01 +08:00
|
|
|
echo ================================
|
|
|
|
|
echo.
|
2026-02-12 10:32:31 +08:00
|
|
|
echo On first run, app will auto-download and install PaddleOCR.
|
2026-02-12 10:14:10 +08:00
|
|
|
echo.
|
|
|
|
|
pause
|