@echo off
setlocal enabledelayedexpansion

:: Check if Python is installed
python --version > temp_ver.txt 2>&1
if %errorlevel% neq 0 (
    echo Python is not installed or not in PATH.
    del temp_ver.txt
    pause
    exit /b
)

:: Extract Python version
for /f "tokens=2 delims= " %%v in (temp_ver.txt) do set PY_VERSION=%%v
del temp_ver.txt

:: Extract major and minor version
for /f "tokens=1,2 delims=." %%a in ("%PY_VERSION%") do (
    set MAJOR=%%a
    set MINOR=%%b
)

:: Check if version is within the range 3.7.x to 3.13.x
if "%MAJOR%"=="3" (
    if %MINOR% GEQ 7 if %MINOR% LEQ 13 (
        echo Python version %PY_VERSION% is within the required range.
        goto INSTALL_LIBS
    )
)

echo Python version %PY_VERSION% is NOT within the required range (3.7.x - 3.13.x).
echo install python form: https://www.python.org/downloads/ 
pause
exit /b

:INSTALL_LIBS
echo Installing necessary libraries...
pip install --upgrade pip
pip install numpy
pip install scikit-learn
echo Installation complete.

pause
@echo off
echo Checking Python installation...
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo Python is not installed or not in PATH.
    pause
    exit /b
)

echo Installing necessary libraries...
pip install --upgrade pip
pip install numpy
pip install scikit-learn

echo Installation complete.
pause