-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows_run.bat
More file actions
57 lines (50 loc) · 1.36 KB
/
Copy pathwindows_run.bat
File metadata and controls
57 lines (50 loc) · 1.36 KB
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
@echo off
setlocal
:: --- SETTINGS ---
set "REQUIRED_PYTHON=3.10"
set "REQUIREMENTS_FILE=requirements.txt"
set "MAIN_SCRIPT=main.py"
:: --- Check Python ---
where python >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python not found in PATH. Please install Python %REQUIRED_PYTHON% or newer.
pause
exit /b 1
)
:: --- Check Python version ---
for /f "tokens=2 delims= " %%v in ('python --version 2^>^&1') do set PY_VER=%%v
for /f "tokens=1,2 delims=." %%a in ("%PY_VER%") do (
set "PY_MAJOR=%%a"
set "PY_MINOR=%%b"
)
if %PY_MAJOR% LSS 3 (
echo [ERROR] Python %REQUIRED_PYTHON% or newer is required. Found Python %PY_VER%.
pause
exit /b 1
)
if %PY_MAJOR%==3 if %PY_MINOR% LSS 10 (
echo [ERROR] Python %REQUIRED_PYTHON% or newer is required. Found Python %PY_VER%.
pause
exit /b 1
)
:: --- Check pip ---
python -m pip --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] pip is not installed. Please install pip for your Python.
pause
exit /b 1
)
:: --- Install dependencies ---
echo [INFO] Installing dependencies from %REQUIREMENTS_FILE%...
python -m pip install -r %REQUIREMENTS_FILE%
if errorlevel 1 (
echo [ERROR] Failed to install dependencies. Please check %REQUIREMENTS_FILE%.
pause
exit /b 1
)
:: --- Run the project ---
echo [INFO] Launching the project...
start "" pythonw %MAIN_SCRIPT%
exit /b 0
endlocal
pause