Author steve.dower docs@python, eryksun, gaborjbernat, keller00, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware 2020-10-16.18:17:42 -1.0 Yes <1602872262.89.0.0334668504757.issue42041@roundup.psfhosted.org>
Content
> The bit that I *do* think is a venv gotcha is that it's entirely reasonable for a user to expect that if they run path\to\venv\Scripts\python.exe, then their Python script will be run by that executable.

This is still true, though, as much as it's ever been. The gotcha is that launching "python" may not launch "path\to\venv\Scripts\python.exe" even if that's the first entry on PATH.

For the documentation, we could phrase it more positively as "If you need the path to the Python executable, use sys.executable. Relying on explicit or implicit PATH resolution may result in the wrong version of Python being used, especially when the user has launched from a virtual environment."
History
Date User Action Args
2020-10-16 18:17:42steve.dowersetrecipients: + steve.dower, paul.moore, vinay.sajip, tim.golden, docs@python, zach.ware, eryksun, gaborjbernat, keller00
2020-10-16 18:17:42steve.dowersetmessageid: <1602872262.89.0.0334668504757.issue42041@roundup.psfhosted.org>