Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"If the code and the comments disagree, then both are probably wrong." -- Norm Schryer


devel / comp.lang.python / Re: How to have python 2 and 3 both on windows?

SubjectAuthor
o Re: How to have python 2 and 3 both on windows?Barry

1
Re: How to have python 2 and 3 both on windows?

<mailman.193.1650646636.20749.python-list@python.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=17965&group=comp.lang.python#17965

 copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry)
Newsgroups: comp.lang.python
Subject: Re: How to have python 2 and 3 both on windows?
Date: Fri, 22 Apr 2022 17:57:03 +0100
Lines: 39
Message-ID: <mailman.193.1650646636.20749.python-list@python.org>
References: <1766896259.80347.1650605332904@mail.yahoo.com>
<1A496C85-0E6A-432B-B455-581F70F648FD@barrys-emacs.org>
Mime-Version: 1.0 (1.0)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de sFGYW7d7pPo9e4+sca3tRAmmW2Q62IUwXyj+HAatANpA==
Return-Path: <barry@barrys-emacs.org>
X-Original-To: Python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:python': 0.06;
'cc:addr:python-list': 0.09; 'from:addr:barry': 0.09; 'installer':
0.09; 'received:217.70': 0.09; 'received:gandi.net': 0.09;
'received:mail.gandi.net': 0.09; 'cc:no real name:2**0': 0.14;
'url:mailman': 0.15; '2022,': 0.16; 'barry': 0.16; 'defaults':
0.16; 'finger': 0.16; 'from:addr:barrys-emacs.org': 0.16;
'impossible': 0.16; 'message-id:@barrys-emacs.org': 0.16;
'python3': 0.16; 'python3.': 0.16; 'subject:windows': 0.16;
'sunil': 0.16; 'tips.': 0.16; 'typing': 0.16; 'windows.': 0.16;
'wrote:': 0.16; 'python': 0.16; 'installing': 0.19;
'cc:addr:python.org': 0.20; 'version': 0.23; 'install': 0.23;
'installed': 0.23; 'subject:How': 0.23; 'run': 0.23; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'cannot': 0.25; 'cc:2**0': 0.25; 'url-
ip:188.166/16': 0.25; 'old': 0.27; 'url-ip:188/8': 0.31; 'python-
list': 0.32; 'path': 0.33; 'windows': 0.34; 'same': 0.34; 'header
:In-Reply-To:1': 0.34; 'file': 0.38; 'way': 0.38; 'edit': 0.39;
'list': 0.39; 'use': 0.39; 'want': 0.40; 'search': 0.61;
'to:addr:yahoo.com': 0.64; 'your': 0.64; 'box': 0.65;
'received:217': 0.67; 'right': 0.68; 'skip:# 10': 0.68; 'tip':
0.69; 'subject:have': 0.75; 'proved': 0.84; 'want.': 0.84; 'opt':
0.89
In-Reply-To: <1766896259.80347.1650605332904@mail.yahoo.com>
X-Mailer: iPad Mail (19E258)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <1A496C85-0E6A-432B-B455-581F70F648FD@barrys-emacs.org>
X-Mailman-Original-References: <1766896259.80347.1650605332904@mail.yahoo.com>
 by: Barry - Fri, 22 Apr 2022 16:57 UTC

> 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
>

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor