[Python-ideas] Make py.exe default to Python 3
Steve Dower
steve.dower at python.org
Tue Mar 15 17:36:26 EDT 2016
On 15Mar2016 1414, Zachary Ware wrote:
> On Tue, Mar 15, 2016 at 3:58 PM, Steve Dower <steve.dower at python.org> wrote:
>> On 15Mar2016 1231, Random832 wrote:
>>>
>>> I think what might be most appropriate would be to have a "Python
>>> Console" in the start menu (alongside the IDLE entry) which sources a
>>> bat file to add the correct python version (and the scripts directory
>>> for pip and easy_install) to that window's PATH, rather than installing
>>> it in the global PATH, and users can learn to start the console from
>>> that icon when they want to run python commands. Inspired by the fact
>>> that e.g. Visual Studio has something that does the same.
>>
>>
>> This is one of two solutions I'd be comfortable with.
>>
>> The other is to rename "py[w].exe" as "python[w].exe".
>
> I've wondered about allowing the launcher to determine the Python it
> should invoke by its own name. That is, if the launcher is named
> 'python3.exe' it should behave as 'py -3'; 'python2.7.exe' should
> behave as 'py -2.7'. I wrote a patch to that effect a year or two ago
> but never got it polished up enough to submit. What about doing this,
> and at launcher install time (or at 'repair installation' time) create
> links for each found Python (and python2/python3 if they exist)?
>
Very tough to automatically install for all found Pythons like this
through an MSI, but if the not-found exit code is 9009 then there's no
reason we can't just install copies for as many versions as we like.
What would also be nice is "activatepyX.Y" scripts (presumably in both
.cmd and .ps1 formats) that would modify the current PATH. I started a
PEP a while back proposing these but never finished.
If we start adding this many files I'd also want to move the launchers
into their own directory (probably "C:\Program Files\Common
Files\Python\Launcher") and add that to the global PATH. As long as we
strictly control what files are in there, I have no problem with adding
it - we just don't want any random DLL or EXE getting in there.
Cheers,
Steve
More information about the Python-ideas
mailing list