summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'share/spack/setup-env.sh')
-rwxr-xr-xshare/spack/setup-env.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index c4c7af4b0a..cbee4428d0 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -326,6 +326,14 @@ if [ "$_sp_shell" = bash ]; then
export -f _spack_shell_wrapper
fi
+# Identify and lock the python interpreter
+for cmd in "${SPACK_PYTHON:-}" python3 python python2; do
+ if command -v > /dev/null "$cmd"; then
+ export SPACK_PYTHON="$(command -v "$cmd")"
+ break
+ fi
+done
+
#
# make available environment-modules
#