Skip to content

Commit

Permalink
python: set also sys._base_executable as venv uses it
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Aug 23, 2023
1 parent 201bbdb commit 08a3497
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkgs/development/interpreters/python/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if paths:
functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo())

# Check whether we are in a venv or virtualenv.
# Check whether we are in a venv or virtualenv.
# For Python 3 we check whether our `base_prefix` is different from our current `prefix`.
# For Python 2 we check whether the non-standard `real_prefix` is set.
# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
Expand All @@ -33,6 +33,7 @@

if 'PYTHONEXECUTABLE' not in os.environ and executable is not None:
sys.executable = executable
sys._base_executable = executable
if prefix is not None:
# Sysconfig does not like it when sys.prefix is set to None
sys.prefix = sys.exec_prefix = prefix
Expand Down

0 comments on commit 08a3497

Please sign in to comment.