[Python-Dev] Python environment registration in the Windows Registry
eryk sun
eryksun at gmail.com
Wed Feb 3 12:23:36 EST 2016
On Wed, Feb 3, 2016 at 10:46 AM, Steve Dower <steve.dower at python.org> wrote:
>
> sys.path.extend(read_subkeys(fr'HKCU\Software\Python\PythonCore\{sys.winver}\PythonPath\**'))
> sys.path.extend(read_subkeys(fr'HKLM\Software\Python\PythonCore\{sys.winver}\PythonPath\**'))
It seems like a bug (in spirit at least) that this step isn't skipped
for -E and -I (Py_IgnoreEnvironmentFlag, Py_IsolatedFlag).
> I haven't looked into pywin32's use of this recently - I tend to only use
> Christoph Gohlke's wheels that don't register anything.
I install the pypiwin32 wheel using pip, which uses pypiwin32.pth:
# .pth file for the PyWin32 extensions
win32
win32\lib
Pythonwin
import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pypiwin32_system32"))
This is different from a PythonPath subkey in a couple of respects.
The paths listed in .pth files are appended to sys.path instead of
prepended. They also don't get added when run with -S or for a venv
environment that excludes site-packages.
More information about the Python-Dev
mailing list