diff --git a/gui_setup.bat b/gui_setup.bat index ae650dd..8ee709d 100644 --- a/gui_setup.bat +++ b/gui_setup.bat @@ -4,7 +4,37 @@ echo Installing PyPEF... set "python_exe=python" set "prefix=" -set /P AREYOUSURE=Install and use local Python version (Y/[N]) (downloads Python installer and installs Python locally in the current working directory)? +for /F "delims=" %%i in ('powershell python --version') do set py_ver=%%i +if not "%py_ver:~0,6%"=="Python" ( + set "true=0" +) else ( + set "true=0" + if "%py_ver:~7,5%"=="3.12." ( + echo Found Python version 3.12. + set "true=1" + ) + if "%py_ver:~7,5%"=="3.11." ( + echo Found Python version 3.11. + set "true=1" + ) + if "%py_ver:~7,5%"=="3.10." ( + echo Found Python version 3.10. + set "true=1" + ) + if "%py_ver:~7,4%"=="3.9." ( + echo Found Python version 3.9. + set "true=1" + ) +) + +if "%true%"=="0" ( + echo Did not find any Python version. Python will be installed locally in the next step... + set /P AREYOUSURE="Y" +) else ( + echo A suitable Python version was found, no local download and Python installtion should be necessary... + set /P AREYOUSURE="Install and use local Python version (Y/[N]) (downloads Python installer and installs Python locally in the current working directory)? " +) + if /I "%AREYOUSURE%" NEQ "Y" if /I "%AREYOUSURE%" NEQ "y" goto NO_PYTHON echo Installing Python... diff --git a/gui_setup.sh b/gui_setup.sh index c74a8cd..70c4669 100755 --- a/gui_setup.sh +++ b/gui_setup.sh @@ -4,6 +4,13 @@ set -e # Only required for WSL(?): # sudo apt-get install -y libxcb-cursor-dev +py_ver="$(python --version)" + +if [[ $py_ver == *"3.12."* ]] || [[ $py_ver == *"3.11."* ]] || [[ $py_ver == *"3.10."* ]] || [[ $py_ver == *"3.9."* ]]; then + echo "Identified Python version should be suitable for installing and running PyPEF..." +else + echo >&2 "The identified Python version ($py_ver) does not match the required Python versions... you should activate/install a suitable version first, e.g. Python 3.12."; exit 1 +fi python -m pip install -U pypef pyside6 printf " @@ -25,4 +32,4 @@ echo "+++ run_pypef_gui.sh +++" echo "+++ for future GUI starting +++" chmod a+x ./run_pypef_gui.sh -./run_pypef_gui.sh && exit +./run_pypef_gui.sh && exit 0