[New-bugs-announce] [issue38905] venv python reports wrong sys.executable in a subprocess on Windows

Tzu-ping Chung report at bugs.python.org
Sun Nov 24 03:17:40 EST 2019


New submission from Tzu-ping Chung <uranusjr at gmail.com>:

To reproduce:

> py -m venv fooenv
> fooenv\Scripts\activate.bat
(fooenv) > python -c "import sys; print(sys.executable)"  % This is correct
C:\Users\uranusjr\Downloads\venvtest\Scripts\python.exe
(fooenv) > python -q
>>> import subprocess
>>> subprocess.check_output(['python', '-c', 'import sys; print(sys.executable)'])
b'C:\\Users\\uranusjr\\AppData\\Local\\Programs\\Python\\Python37\\python.exe\r\n'

The output shows the base interpreter, not the interpreter in venv. Not sure whether this is a venv or subprocess problem.

----------
components: Library (Lib), Windows
messages: 357392
nosy: paul.moore, steve.dower, tim.golden, uranusjr, zach.ware
priority: normal
severity: normal
status: open
title: venv python reports wrong sys.executable in a subprocess on Windows
versions: Python 3.7, Python 3.8

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


More information about the New-bugs-announce mailing list