Message 334545 - Python tracker (original) (raw)

Actually, it seems like venv symlinks are so far from working that they haven't worked (on Windows) since 3.5 or possibly earlier.

I use venv with --symlinks prior to 3.7.2. It works fine as far as I can tell. Perhaps you could elaborate. I assumed you removed it because it's not compatible with the Microsoft Store release for some reason.

The loader doesn't resolve links, so it should work as long as the python.exe, python3x.dll, python3.dll, and vcruntime140.dll files are linked together in the Scripts directory.

>>> hPython3 = ctypes.WinDLL('python3')._handle
>>> hVcruntime140 = ctypes.WinDLL('vcruntime140')._handle
>>> for h in (0, sys.dllhandle, hPython3, hVcruntime140):
...     print(_winapi.GetModuleFileName(h), '->')
...     print('\t', os.readlink(_winapi.GetModuleFileName(h)))
...
C:\Temp\env36\scripts\python.exe ->
         C:\Program Files\Python36\python.exe
C:\Temp\env36\scripts\python36.dll ->
         C:\Program Files\Python36\python36.dll
C:\Temp\env36\scripts\python3.dll ->
         C:\Program Files\Python36\python3.dll
C:\Temp\env36\scripts\VCRUNTIME140.dll ->
         C:\Program Files\Python36\vcruntime140.dll

>>> print(sys.executable)
C:\Temp\env36\scripts\python.exe

>>> print(*sys.path, sep='\n')

C:\Temp\env36\scripts\python36.zip
C:\Program Files\Python36\DLLs
C:\Program Files\Python36\lib
C:\Program Files\Python36
C:\Temp\env36
C:\Temp\env36\lib\site-packages