> On Mar 23, 2020, at 11:16, Frédéric De Jaeger <fdejae...@novaquark.com> wrote: > > The command: > > python myscript.py > > launches python3 on windows and python2 on 99% of the unix market.
While that’s true for Mac 10.14, Ubuntu 18.04 LTS, etc., I think almost everyone is deprecating Python 2 in their current releases, so that’s not really true anymore. And, while there’s nothing wrong with running 2-year-old OS versions, I’m not sure it’s worth making any changes to Python to help such environments, because it won’t help many people until after it’s too late to matter anyway. (If Python 3.10 does something different, and it becomes the default in Ubuntu 22.04 LTS, your company probably won’t see any benefit until at least 2023…) It’s worth reading PEP 394 (the Python command on Unix-like systems) and PEP 397 (the Python launcher for Windows) for background. But I think the assumption is that you create executable scripts with #! /usr/bin/env python3, and then your other scripts just execute the scripts directly, which will go through the default shell on *nix (which will process the shbang line and run whatever is called python3 on the path) and through py.exe on Windows (which has special code to understand common shbang lines and do the right thing). But there are other options to make things even easier. If you use virtual environments, the python command inside a venv always runs the Python version for that venv. If you create things to be installed rather than run in-place, setuptools entry points automatically get turned into scripts set up in a way that’s appropriate for the local system. If you have Windows users who aren’t Python-savvy at all, it may even be worth using one of the binary-program makers like PyInstaller so they can just run an installer off your intranet and get something that looks like a normal .exe file on their PATH that doesn’t depend on any Python installation. One more thing: > On windows, most users use Cygwin to do their terminal based business (`git`, > `cmake`, ...). It’s been a while since I worked in a Cygwin-heavy environment, but if you’re writing shell scripts to run in Cygwin that use Python scripts, don’t you still need a Cygwin Python rather than a native Windows ones, so things like pathnames work properly? Or is that not a problem anymore? And if you do, doesn’t the Cygwin Python 3 package install something named python3 that’s on the (Cygwin) PATH, same as on your *nix systems? _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6HVWI3AHDBNOWE3X3CQQBGXRQMQNGUIG/ Code of Conduct: http://python.org/psf/codeofconduct/