<p dir="ltr"><br>
On 16 Apr 2014 06:27, "Eric V. Smith" <<a href="mailto:eric@trueblade.com">eric@trueblade.com</a>> wrote:<br>
><br>
> On 04/15/2014 10:12 PM, Nick Coghlan wrote:<br>
> > Something that came up during PyCon was the idea of a "py" script that<br>
> > brought "Python Launcher for Windows" explicit version dispatch to Linux.<br>
> ><br>
> > Anyone care to try their hand at writing such a script?<br>
><br>
> I meant to bring this up at the PyCon sprints. On Windows, the launcher<br>
> finds the various versions of Python by looking in the registry. How is<br>
> a Linux version supposed to find what versions of Python are installed?<br>
><br>
> I have a pristine 2.7 in /usr/local/bin and the system python 2.7 in<br>
> /usr/bin. I've also seen /opt/bin used, and other places deliberately<br>
> not on PATH. How would a launcher find these, let alone decide which one<br>
> to use?</p>
<p dir="ltr">Note that my main interest here is in making commands like:</p>
<p dir="ltr">    py -3 -m pip install foo</p>
<p dir="ltr">cross platform rather than Windows specific. At the moment we don't have a way to explicitly invoke Python 3 that works everywhere.</p>
<p dir="ltr">Given the way POSIX installations of Python name things, simple string munging, along with delegation to the shell's normal shebang line processing when given a script without nominating a particular version to use, should suffice to largely reproduce the PEP 397 behaviour.</p>

<p dir="ltr">The launcher config file also provides an opportunity to make the "default Python" a per user setting without altering which version the "python" symlink refers to.</p>
<p dir="ltr">Cheers,<br>
Nick.</p>
<p dir="ltr">><br>
> I'll be around the sprints for a very short time this morning, if anyone<br>
> wants to discuss it.<br>
><br>
> Eric.<br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>