I need to run Python interpreter with custom parameters and custom environment.
Let's say I create a bash script which exports required variables and calls /usr/bin/python3
with required parameters. When I run Python via this script, sys.executable
will be still /usr/bin/python3
.
Can I somehow construct the wrapper script such that sys.executable
would report the path of the wrapper script? I tried exec /usr/bin/python3
, but this didn't change the matters.
sys.executable
. Perhaps you want to look insys.argv[0]
?