Am 22.12.2023 um 14:13 schrieb Barry:
On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list
<python-list@python.org> wrote:
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
This has always worked well. I could run Python scripts in a console
window entering just the script name, by double clicking in the explorer
or using WIN+r; the two last variants for GUI or for scripts with
something like "input('Leave with Enter')" at the end.
Now I've got a new computer with Windows 11 and I've installed Python
3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
the Python documentation it seems my shebang lines should work as before
- but they don't. The error message:
"Unable to create process using 'C:\usr\bin\env\python
"C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
Datei nicht finden."
Without the "env" in the shebang line and only without it everything
works as expected - but that's contrary to the documentation, isn't it?
This suggests a typo in the shebang line. Is there a space between env and
python?
Barry
Tried several variants with the same script:
#!/usr/bin/env python3
# That's how I wrote it for Windows 10 / Python 3.11. It works there.
#!/usr/bin/env python
#!/usr/bin/env/python
The error messages vary a little. This is a German Windows installation,
the two variants with the space produce the same German error message,
the third produces the message I've put into my first description.
The working variant on Windows 11 / Python 3.12 is "#!/usr/bin python".
Thank you,
Sibylle
--
https://mail.python.org/mailman/listinfo/python-list