> On 22 Apr 2022, at 17:10, Sunil KR via Python-list <python-list@python.org> 
> wrote:
> 
> I have some scripts that are old and won't work under python2 and at the 
> same time I am writing new scripts which will use python3. However, if python 
> 2 and 3 cannot co-exist in a windows box it will be impossible to transition
> What I try:- remove all pythons and launchers- Use windows installer and 
> install python2 in python27 directory- Use windows installer and install 
> python3 in python310 directory- When installing python3 I opt in to install 
> the launcher- Test with py -2 and py -3 and see that I get the expected 
> prompt- just typing python gets me python2

As you have proved you can install many versions of python at the same time on 
windows.

In your scripts set the shebang to run the python version you want.
E.g
#!/usr/bin/python2
Or
#!/usr/bin/python3

The python launcher py.exe will then do the right thing after looking at en 
shebang line.

Also you can edit the INI file of the py.exe launcher to set the defaults the 
way you want them. Do a search for “py.exe ini” to file the path to the file, I 
do not have it my finger tips.

Tip “py.exe -0” will list the state of installed pythons.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to