Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Sibylle Koczian
nulla.epistola at web.de
Sun Jan 7 10:09:35 EST 2024
Am 01.01.2024 um 12:50 schrieb Barry via Python-list:
>
>
>> On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list <python-list at python.org> wrote:
>>
>> But in all this thread I didn't see a single explanation for my current situation: one and the same shebang line works on Windows 10 / Python 3.11 and doesn't work on Windows 11 / Python 3.12. I suspect Windows, because a change in the way Python 3.12 uses shebang lines should be visible in the documentation.
>
> See my earlier reply with info on ftype etc output.
> What do you see on your windows 10 vs windows 11?
>
Oh yes, I forgot to answer, here are my results:
py -0:
1. Windows 10, Python 3.11.5:
-V:3.11 * Python 3.11 (64-bit)
-V:3.6 Python 3.6 (64-bit) possibly part of Visual Studio or
else Calibre?
2. Windows 11, Python 3.12.1;
-V:3.12 * Python 3.12 (64-bit)
assoc .py
1. Windows 10, Python 3.11.5:
.py=Python.File
2. Windows 11, Python 3.12.1:
.py=Python.File
ftype Python.File
1. Windows 10, Python 3.11.5:
Python.File="C:\WINDOWS\py.exe" "%L" %*
2. Windows 11, Python 3.12.1:
Python.file="C:\Windows\py.exe" "%L" %*
Test Script test_shebang.py starts with one of these shebang lines:
a) #! python
b) #! /usr/bin/python
c) #! /usr/bin/env python
import sys
print(sys.executable)
Results:
1. Windows 10, Python 3.11.5:
test_shebang.py, Version a): C:\Program Files\Python311\python.exe
py test_shebang.py, Version a): C:\Program Files\Python311\python.exe
test_shebang.py, Version b): C:\Program Files\Python311\python.exe
py test_shebang.py, Version b): C:\Program Files\Python311\python.exe
test_shebang.py, Version c): C:\Program Files\Python311\python.exe
py test_shebang.py, Version c): C:\Program Files\Python311\python.exe
2. Windows 11, Python 3.12.1:
test_shebang.py, Version a): C:\Program Files\Python312\python.exe
py test_shebang.py, Version a): C:\Program Files\Python312\python.exe
test_shebang.py, Version b): C:\Program Files\Python312\python.exe
py test_shebang.py, Version b): C:\Program Files\Python312\python.exe
test_shebang.py, Version c):
Python konnte nicht gefunden werden. F³hren Sie die Verkn³pfung ohne
Argumente aus, um sie ³ber den Microsoft Store zu installieren, oder
deaktivieren Sie diese Verkn³pfung unter
py test_shebang.py, Version c):
Python konnte nicht gefunden werden. F³hren Sie die Verkn³pfung ohne
Argumente aus, um sie ³ber den Microsoft Store zu installieren, oder
deaktivieren Sie diese Verkn³pfung unter
It's a german Windows version, first sentence: "Python could not be
found". I don't really know how to translate the second sentence.
Oh, and the two Windows and Python versions are on two different computers.
Will remove the "/env" from my shebang lines, even if I don't understand
what's happening.
Thank you for helping,
Sibylle
More information about the Python-list
mailing list