Python 3.6 installation doesn't add launcher to PATH

eryk sun eryksun at gmail.com
Sun Feb 26 12:27:11 EST 2017


On Sun, Feb 26, 2017 at 3:09 PM, ChrisW <c.c.wood at gmail.com> wrote:
> On Saturday, 25 February 2017 07:21:30 UTC, eryk sun  wrote:
>> On Fri, Feb 24, 2017 at 12:38 PM, ChrisW wrote:
>> > However, I've installed Python 3.6 with the 'include PATH' checkbox ticked
>> > for my user only, and although C:\Windows\py.exe exists, it has not been
>> > added to my PATH.
>> >
>> > I also tried installing for all users, and this also doesn't add it to the PATH.
>> >
>> > Is this a bug, or have I done something wrong?!
>>
>> What the installer adds to PATH is the Python36[-32] directory that
>> has python.exe and the Scripts directory that has pip.exe. The
>> recommended way to run Python is via the "python" command not "py".
>> The py launcher is mainly for shell executing script files with
>> shebang processing. That said people do use py -X[-Y[-32]] as a
>> convenient way to run multiple versions of Python without modifying
>> PATH.
>>
>> As to adding SystemRoot to PATH, it should be there already. This
>> doesn't matter if the program lets CreateProcess search because it
>> always searches system directories before PATH. But it matters in a
>> common case; cmd.exe does its own search and only searches PATH (and
>> also the current directory if the system is configured insecurely).
>
> Hmm, that seems to contradict what the docs say: `py` is recommended for
> Windows users who want to run various versions (not just for executing scripts).

"python" is the recommended way to run Python that's cross-platform.
The last thing I'd want is to see tutorials and FAQs filled with
caveats that Windows users should use py -X[.Y[-32]] instead of
python. It can be assumed that the environment is configured correctly
for the python command to run the desired version of the interpreter.
The best way to do that is to develop using virtual environments.

Steve Dower (Microsoft) and Nick Coghlan (Red Hat) have made
suggestions for a new "python" launcher that can run multiple versions
and would be available on all platforms. I've yet to see any specific
discussion about this idea on python-ideas or python-dev -- at least
not to the point that someone is willing to write a PEP and start
coding. It's just a pipe dream for now.

> SystemRoot is not in my PATH variable.

Open the environment variables editor in the system properties window;
double-click on "Path" in the system variables and insert the
following at the beginning:

%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;

These are present by default when Windows is installed -- except
%SystemRoot% may already be expanded to C:\Windows, or wherever
Windows is installed on the system. Someone or some program messed up
if they're missing.



More information about the Python-list mailing list