Fix start.bat UTF-8 BOM and robust Python detection

This commit is contained in:
Sivarius
2026-07-03 17:04:07 +08:00
parent 330b79288b
commit 2a178dc943
5 changed files with 31 additions and 19 deletions
+31 -19
View File
@@ -1,36 +1,48 @@
@echo off @echo off
chcp 65001 > nul chcp 65001 > nul
title Tesseract Web GUI title Tesseract Web GUI
:: Путь к папке проекта :: Path to project folder
set APP_DIR=%~dp0 set "APP_DIR=%~dp0"
cd /d "%APP_DIR%" cd /d "%APP_DIR%" || exit /b 1
:: Проверяем Python :: Find Python
where python > nul 2> nul for %%P in (python python3 py) do (
%%P --version >nul 2>nul
if not errorlevel 1 (
set "PYTHON=%%P"
goto :found_python
)
)
echo [ERROR] Python not found. Install Python 3.10+ and add it to PATH.
pause
exit /b 1
:found_python
echo [OK] Python: %PYTHON%
:: Install deps
echo [1/3] Installing dependencies...
%PYTHON% -m pip install -q flask pillow pytesseract
if errorlevel 1 ( if errorlevel 1 (
echo [Ошибка] Python не найден. Установи Python 3.10+ и добавь в PATH. echo [ERROR] Failed to install dependencies.
pause pause
exit /b 1 exit /b 1
) )
:: Установка зависимостей (пропустит если уже стоят) :: Check Tesseract
echo [1/3] Проверка зависимостей...
python -m pip install -q flask pillow pytesseract
:: Проверяем Tesseract
if not exist "C:\Program Files\Tesseract-OCR\tesseract.exe" ( if not exist "C:\Program Files\Tesseract-OCR\tesseract.exe" (
echo [Предупреждение] Tesseract не найден по пути C:\Program Files\Tesseract-OCR\tesseract.exe echo [WARNING] Tesseract not found at C:\Program Files\Tesseract-OCR\tesseract.exe
echo Установи: winget install UB-Mannheim.TesseractOCR echo Install: winget install UB-Mannheim.TesseractOCR
pause pause
exit /b 1 exit /b 1
) )
echo [OK] Tesseract found
:: Запуск :: Start
echo [2/3] Запуск веб-сервиса... echo [2/3] Starting web service...
echo [3/3] Открой браузер: http://127.0.0.1:5000/ echo [3/3] Open browser: http://127.0.0.1:5000/
echo. echo.
%PYTHON% app.py
python app.py
pause pause
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB