This will make it more robust when accidentally invoked from a sage shell inside another Sage installation.
Related to https://groups.google.com/g/sage-release/c/GOGWk66zaCQ/m/0o9KtVDIAAAJ
Depends on #33787
CC: @dimpase @orlitzky @jhpalmieri
Component: scripts
Author: Matthias Koeppe
Branch/Commit: 01caa38
Reviewer: John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/33786