[Python-ideas] Make py.exe default to Python 3

Steve Dower steve.dower at python.org
Tue Mar 15 16:58:11 EDT 2016


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

PATH is used to resolve system DLLs and common commands. Over time, 
better security features are being added for core system components, but 
it is still possible to hijack programs this way.

It also has a serious conflict problem once the second version of Python 
is installed with this option enabled, in that *anything* currently 
referring to just "python" will change. In my experience, it's mostly 
Python 3.x turning into 2.7 because a keen Python developer meets a 
jaded one and gets told they should only be using old things...

Windows Installer does not have a nice mechanism to handle ordering of 
PATH entries or detecting existing ones, unless all the installers are 
cooperating. It certainly doesn't handle any case here where users may 
add/remove Python installs whenever they like. This is why the launcher 
was created.

I have always been -1 on modifying PATH by default, and trading an early 
problem for a later, more subtle, problem does not convince me. And I 
say this as someone who has taught classes of undergraduate students how 
to use Python on Windows, and had to deal with the same problems.

I'm not trying to lord it over the installer just because I'm the one 
who wrote and maintains it - if someone else files a patch and one of 
the other committers puts it in, so be it. But I'd much rather (a) make 
users choose up front to have an environment where "python.exe" is 
easily accessible, or (b) make "python.exe" consistently launch the 
right version.

Cheers,
Steve


More information about the Python-ideas mailing list