Files
cutThenThink/build.bat

77 lines
1.8 KiB
Batchfile
Raw Normal View History

@echo off
REM ================================
REM CutThenThink Windows Build Script
REM ================================
REM Change to project directory
cd /d "%~dp0"
REM Check Python
echo Checking Python...
python --version 2>nul
if errorlevel 1 (
echo Python not found. Please install Python 3.8+
pause
exit /b 1
)
REM Get Python version
for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYVER=%%i
echo Detected Python %PYVER%
echo.
echo 1/5. Installing PyInstaller...
python -m pip install --user pyinstaller 2>nul
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
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
REM Install build dependencies
python -m pip install --user setuptools 2>nul
echo.
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 ^
src/main.py
if errorlevel 1 (
echo.
echo ================================
echo Build Failed!
echo ================================
pause
exit /b 1
)
echo.
echo ================================
echo Build Complete!
echo Executable: dist\CutThenThink.exe
echo File size: ~30-50 MB
echo ================================
echo.
echo On first run, app will auto-download and install PaddleOCR.
echo.
pause