Skip python executables that don't exist
@@ -176,9 +176,12 @@ log "=================================================="
PYTHON=
for PYTHON_EXECUTABLE in python python3 python3.6 python3.7
do
- # Get exact version of python interpreter
+ # Skip python executables that don't exist in PATH
+ if ! which ${PYTHON_EXECUTABLE}; then
+ continue
+ fi
+
possible_python=$(which ${PYTHON_EXECUTABLE})
- if [ -n "$possible_python" ]; then
HAVE=$(${possible_python} --version 2>&1 | awk '{ print $2 }')
# Stop if version is new enough
if echo -e "${HAVE}\n3.6" | sort -V | head -1 | grep "^3.6$"
@@ -186,7 +189,6 @@ do
PYTHON=${possible_python}
break
fi
- fi
done
if [ -z "${PYTHON}" ]
then
