diff --git a/installer/install.sh.in b/installer/install.sh.in index 6757447416..1b8ba92ea6 100755 --- a/installer/install.sh.in +++ b/installer/install.sh.in @@ -13,12 +13,16 @@ MAXIMUM_PYTHON_VERSION=3.11.100 PYTHON="" for candidate in python3.11 python3.10 python3.9 python3 python ; do if ppath=`which $candidate`; then + # when using `pyenv`, the executable for an inactive Python version will exist but will not be operational + # we check that this found executable can actually run + if [ $($candidate --version &>/dev/null; echo ${PIPESTATUS}) -gt 0 ]; then continue; fi + python_version=$($ppath -V | awk '{ print $2 }') if [ $(version $python_version) -ge $(version "$MINIMUM_PYTHON_VERSION") ]; then - if [ $(version $python_version) -le $(version "$MAXIMUM_PYTHON_VERSION") ]; then - PYTHON=$ppath - break - fi + if [ $(version $python_version) -le $(version "$MAXIMUM_PYTHON_VERSION") ]; then + PYTHON=$ppath + break + fi fi fi done