-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.bat
60 lines (54 loc) · 1.45 KB
/
run.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
setlocal enabledelayedexpansion
REM Change to script directory
cd /d "%~dp0"
REM Check Python installation
where python >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Python is not installed or not in PATH
echo Please install Python 3.11 or newer from https://www.python.org/
pause
exit /b 1
)
REM Check Python version
python -c "import sys; assert sys.version_info >= (3, 11), 'Python 3.11 or newer is required'" >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Python 3.11 or newer is required
echo Current Python version:
python --version
pause
exit /b 1
)
REM Create virtual environment if it doesn't exist
if not exist venv (
echo Virtual environment not found! Creating one...
python -m venv venv
if %ERRORLEVEL% neq 0 (
echo Failed to create virtual environment
pause
exit /b 1
)
echo Installing dependencies...
call venv\Scripts\activate
pip install --upgrade --requirement requirements.txt
if %ERRORLEVEL% neq 0 (
echo Failed to install dependencies
pause
exit /b 1
)
) else (
echo Virtual environment found. Activating...
)
REM Activate virtual environment and run the application
call venv\Scripts\activate
if %ERRORLEVEL% neq 0 (
echo Failed to activate virtual environment
pause
exit /b 1
)
echo Starting WebUI...
venv\Scripts\python.exe main.py
if %ERRORLEVEL% neq 0 (
echo Application exited with error code %ERRORLEVEL%
pause
)