[Python-Dev] Finally fix installer to add Python to %PATH% on Windows
brian.curtin at gmail.com
Fri Jan 28 17:29:07 CET 2011
On Fri, Jan 28, 2011 at 10:12, anatoly techtonik <techtonik at gmail.com>wrote:
> Hi, I'd like to
> You probably know that after installation on Windows system it is
> possible to call Python from Explorer's Run dialog (Win-R). It is
> because Python path is added to App Paths registry key and Windows
> Explorer shell checks this key when looking for executable.
> But Python doesn't work from cmd session and, more importantly,
> *Python doesn't work from .bat files*. It is because cmd shell doesn't
> know about App Paths and relies on system PATH to find executable. As
> far as I remember, there is no function in Python stdlib either, that
> executes processes and does lookups in App Paths.
> I never paid much attention to this fact, because I put several .bat
> files for every 25, 26, 27, 31 and 32 version of Python into PATH
> manually. But when bootstrap script for build environment of Native
> Client (NaCl) said that I have no Python available and started to
> install its own, I've asked myself - "How come? There are 5! possible
> versions of Python on my system." It appeared that the following .bat
> file doesn't work:
> ---cut mypy.bat--
> ---cut mypy.bat--
> 'python.exe' is not recognized as an internal or external command,
> operable program or batch file.
> I've seen about 7 requests to add Python into %PATH% in installer. All
> closed with no result, but with some fear and uncertainty. Martin
> feared that MSI installers are not able to remove entry from PATH and
> even if they can, they may kill the whole PATH instead of removing
> just one entry.
> To prove or dispel these fears, I've just installed/uninstalled
> Mercurial from mercurial-1.7.3-1-x86.msi and App Engine from
> GoogleAppEngine-1.4.1.msi several times. Both add entries to PATH and
> both remove them without any further problems. Should we finally add
> this to 3.2 installer for Python?
> anatoly t.
Definitely not for 3.2, but this is something I'd like to look into for 3.3.
Recently I've talked to two Python trainers/educators and the major gripe
their attendees see is that you can't just sit down and type "python" and
have something work. For multi-Python installs, we'll have to define what
that "something" is, but I think it should be possible for the installer to
optionally put Python into the path, and to also remove itself on uninstall.
One of said trainers is running a course inside my company right now and the
training room VMs they are running on do not have the path setup. Some users
were puzzled as to why "python foo.py" doesn't work, but executing "foo.py"
does (via file association).
One quick-and-dirty solution was to create a "Command Shell" shortcut in the
start menu which would just be a batch file that adds Python to the path for
that cmd session. It would be kind of similar to the "Python (command line)"
shortcut, which uses pythonw.exe. I think we can do better than this,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev