Python 2.7 and 3.9

Thomas Jollans tjol at tjol.eu
Wed Feb 17 09:09:12 EST 2021


On 16/02/2021 22:16, Ethan Furman wrote:
> Kevin, please reply to the list (preferably Reply-to-list, or 
> Reply-all), that way others can chime in with help.
>
> On 2/16/21 12:55 PM, Kevin M. Wilson wrote:
>
>> Windows 7 OS, and typically run in conjunction with testing SSD', as 
>> for stand alone scripts.
>> Those require: python BogusFile.py. I too was expecting users to 
>> type: python my_Script.py!

On Windows, you should use the py.exe launcher:

py -2 python2_script.py

to run an old script, and

py -3 python3_script.py

or

py python3_script.py

to launch a new script. AKAIK, the launcher is always installed with 
recent versions of Python on Windows.


You could set up the PATH such that 'python' is python 2.7, and 'py' 
calls python 3.x. Have a look at the docs to figure about what other 
options py.exe gives you (such as shebang lines)

Docs: 
https://docs.python.org/3/using/windows.html#python-launcher-for-windows

PEP: https://www.python.org/dev/peps/pep-0397


-- Thomas





More information about the Python-list mailing list