-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python3 shebang does not work with py.exe and venv on Windows #103679
Comments
This issue was raised before, however there is no clear resolution: |
😢 |
At least the new py launcher that's included with Python 3.11 supports searching The launcher could also implement "#!/usr/bin/env python[3]" to prefer an active virtual environment over searching |
Thanks, I will test this with 3.13 release, then. |
Bug report
Have the following:
py.exe
set-up to start Python programs (withPATHEXT
env var set to...;.PY
)venv
environment with Python 3Now running Python program with shebang
#! /usr/bin/env python
works fine, but#! /usr/bin/env python3
does not.I am running the same script on Debian 11:
python3
andpython3.9
executables system-wide, sopython
shebang does not work, butpython3
works.venv
environment (used during development) haspython
,python3
andpython3.9
executables, so bothpython
andpython3
shebangs work.python.exe
undervenv
, sopython3
shebang picks-up MS Store version and not thevenv
version, so it has wrong modules.On Debian 11 the only usable shebang for all my use cases is
python3
, but that one does not work under Windows.Current workaround is to make a copy on Windows in
venv/Scripts/python.exe
tovenv/Scripts/python3.exe
. Then thepython3
shebang works fine.Your environment
py.exe
left by installation of previous Python MSI version after uninstalling Python (and intentionally keepingpy.exe
).The text was updated successfully, but these errors were encountered: