youtube-translator / setup.bat
RIZ484848's picture
upload youtube_translator
e4bcf43 verified
@echo off
title LCK Translator Setup
cd /d "%~dp0"
echo.
echo ==========================================
echo LCK Translator - Setup
echo ==========================================
echo Working dir: %CD%
echo.
echo *** PRESS ANY KEY TO START SETUP ***
pause >nul
echo.
rem ----- Step 1: detect python -----
echo [Step 1/4] Detecting Python...
set "PYEXE="
where python >nul 2>nul
if %errorlevel%==0 set "PYEXE=python"
if "%PYEXE%"=="" (
where py >nul 2>nul
if %errorlevel%==0 set "PYEXE=py -3"
)
if "%PYEXE%"=="" (
echo [ERROR] Python not found in PATH.
echo Install Python 3.10+ from https://www.python.org/downloads/
echo Be sure to check "Add Python to PATH" in the installer.
goto :end
)
echo Found: %PYEXE%
%PYEXE% --version
if errorlevel 1 (
echo [ERROR] Python could not be executed.
goto :end
)
echo.
rem ----- Step 2: venv -----
echo [Step 2/4] Creating virtual environment .venv ...
if exist .venv (
echo .venv already exists - skipping creation.
) else (
%PYEXE% -m venv .venv
if errorlevel 1 (
echo [ERROR] Failed to create .venv
goto :end
)
)
echo.
rem ----- Step 3: pip upgrade -----
echo [Step 3/4] Upgrading pip ...
call ".venv\Scripts\activate.bat"
if errorlevel 1 (
echo [ERROR] Failed to activate .venv
goto :end
)
python -m pip install --upgrade pip
echo.
rem ----- Step 4: install requirements -----
echo [Step 4/4] Installing dependencies (this can take 5-10 minutes)...
echo (Watch for any red ERROR lines in the output below)
echo.
python -m pip install -r requirements.txt
set "RC=%errorlevel%"
echo.
if not "%RC%"=="0" (
echo [ERROR] pip install failed with exit code %RC%
goto :end
)
echo.
echo ==========================================
echo SETUP COMPLETE
echo Now double-click run.bat to launch.
echo ==========================================
:end
echo.
echo *** PRESS ANY KEY TO CLOSE THIS WINDOW ***
pause >nul