Fix start.bat UTF-8 BOM and robust Python detection
This commit is contained in:
@@ -1,36 +1,48 @@
|
||||
@echo off
|
||||
@echo off
|
||||
chcp 65001 > nul
|
||||
title Tesseract Web GUI
|
||||
|
||||
:: Путь к папке проекта
|
||||
set APP_DIR=%~dp0
|
||||
cd /d "%APP_DIR%"
|
||||
:: Path to project folder
|
||||
set "APP_DIR=%~dp0"
|
||||
cd /d "%APP_DIR%" || exit /b 1
|
||||
|
||||
:: Проверяем Python
|
||||
where python > nul 2> nul
|
||||
:: Find Python
|
||||
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 (
|
||||
echo [Ошибка] Python не найден. Установи Python 3.10+ и добавь в PATH.
|
||||
echo [ERROR] Failed to install dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Установка зависимостей (пропустит если уже стоят)
|
||||
echo [1/3] Проверка зависимостей...
|
||||
python -m pip install -q flask pillow pytesseract
|
||||
|
||||
:: Проверяем Tesseract
|
||||
:: Check Tesseract
|
||||
if not exist "C:\Program Files\Tesseract-OCR\tesseract.exe" (
|
||||
echo [Предупреждение] Tesseract не найден по пути C:\Program Files\Tesseract-OCR\tesseract.exe
|
||||
echo Установи: winget install UB-Mannheim.TesseractOCR
|
||||
echo [WARNING] Tesseract not found at C:\Program Files\Tesseract-OCR\tesseract.exe
|
||||
echo Install: winget install UB-Mannheim.TesseractOCR
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] Tesseract found
|
||||
|
||||
:: Запуск
|
||||
echo [2/3] Запуск веб-сервиса...
|
||||
echo [3/3] Открой браузер: http://127.0.0.1:5000/
|
||||
:: Start
|
||||
echo [2/3] Starting web service...
|
||||
echo [3/3] Open browser: http://127.0.0.1:5000/
|
||||
echo.
|
||||
|
||||
python app.py
|
||||
%PYTHON% app.py
|
||||
|
||||
pause
|
||||
|
||||
Reference in New Issue
Block a user