diff --git a/setup.bat b/setup.bat index 55d764cf..c3e68fbc 100644 --- a/setup.bat +++ b/setup.bat @@ -24,31 +24,39 @@ if %ERRORLEVEL% neq 0 ( exit /b 1 ) -:: Check for Python 3.10 specifically +:: Check for Python 3.9 or 3.10 set PYTHON_CMD= where python3.10 >nul 2>&1 if %ERRORLEVEL% equ 0 ( set PYTHON_CMD=python3.10 ) else ( - where python >nul 2>&1 + where python3.9 >nul 2>&1 if %ERRORLEVEL% equ 0 ( - for /f "tokens=*" %%i in ('python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"') do ( - set PY_VERSION=%%i - if "!PY_VERSION!" == "3.10" ( - set PYTHON_CMD=python + set PYTHON_CMD=python3.9 + ) else ( + where python >nul 2>&1 + if %ERRORLEVEL% equ 0 ( + for /f "tokens=*" %%i in ('python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"') do ( + set PY_VERSION=%%i + if "!PY_VERSION!" == "3.10" ( + set PYTHON_CMD=python + ) else if "!PY_VERSION!" == "3.9" ( + set PYTHON_CMD=python + ) ) ) ) ) if "%PYTHON_CMD%" == "" ( - echo Error: Python 3.10 is not installed or not in PATH - echo Please install Python 3.10: https://www.python.org/downloads/ + echo Error: Python 3.9 or 3.10 is not installed or not in PATH + echo Please install Python 3.9 or 3.10: https://www.python.org/downloads/ exit /b 1 ) for /f "tokens=*" %%i in ('where %PYTHON_CMD%') do set PYTHON_PATH=%%i -echo Found Python 3.10: %PYTHON_PATH% +for /f "tokens=*" %%i in ('%PYTHON_CMD% -c "import sys; print(f\"Python {sys.version_info.major}.{sys.version_info.minor}\")"') do set PYTHON_VER=%%i +echo Found %PYTHON_VER%: %PYTHON_PATH% where poetry >nul 2>&1 if %ERRORLEVEL% neq 0 ( diff --git a/setup.sh b/setup.sh index 0087e44b..21aba050 100755 --- a/setup.sh +++ b/setup.sh @@ -20,24 +20,26 @@ if ! command -v git &> /dev/null; then exit 1 fi -# Check for Python 3.10 specifically +# Check for Python 3.9 or 3.10 PYTHON_CMD="" if command -v python3.10 &> /dev/null; then PYTHON_CMD="python3.10" +elif command -v python3.9 &> /dev/null; then + PYTHON_CMD="python3.9" elif command -v python3 &> /dev/null; then PY_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') - if [[ "$PY_VERSION" == "3.10" ]]; then + if [[ "$PY_VERSION" == "3.10" || "$PY_VERSION" == "3.9" ]]; then PYTHON_CMD="python3" fi fi if [ -z "$PYTHON_CMD" ]; then - echo "Error: Python 3.10 is not installed or not in PATH" - echo "Please install Python 3.10: https://www.python.org/downloads/" + echo "Error: Python 3.9 or 3.10 is not installed or not in PATH" + echo "Please install Python 3.9 or 3.10: https://www.python.org/downloads/" exit 1 fi -echo "Found Python 3.10: $(which $PYTHON_CMD)" +echo "Found Python $(${PYTHON_CMD} -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")'): $(which $PYTHON_CMD)" if ! command -v poetry &> /dev/null; then echo "Error: Poetry is not installed or not in PATH"