[issue42013] venv on Windows with symlinks is broken if invoked with -I

Eryk Sun report at bugs.python.org
Mon Oct 12 10:14:48 EDT 2020


Eryk Sun <eryksun at gmail.com> added the comment:

This issue is partly due to bpo-8901, which changed the behavior of the -E and -I command-line options to make them ignore the default PythonPath value in the registry key "Software\Python\PythonCore\X.Y\PythonPath". The change itself is not wrong. It's just exposing an underlying problem.

The `home` path in pyvenv.cfg is from sys._base_executable. In a launcher-based environment that's created from the base installation, sys._base_executable is the real base executable. OTOH, in a symlink-based virtual environment, sys._base_executable is the same as sys.executable. Consequently, if a virtual environment is created from a symlink-based virtual environment, the `home` path in pyvenv.cfg refers to the creating environment instead of the base installation. In this case, with the current implementation, the standard library can only be found by falling back on the default PythonPath in the registry.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42013>
_______________________________________


More information about the Python-bugs-list mailing list