Why does Python never add itself to the Windows path?

Ben Sizer kylotan at gmail.com
Sat Dec 30 19:55:09 EST 2006


Martin v. Löwis wrote:

> Ben Sizer schrieb:
> > I've installed several different versions of Python across several
> > different versions of MS Windows, and not a single time was the Python
> > directory or the Scripts subdirectory added to the PATH environment
> > variable. Every time, I've had to go through and add this by hand, to
> > have something resembling a usable Python installation. No such
> > problems on Linux, whether it be Mandrake/Mandriva, Fedora Core, or
> > Kubuntu. So why is the Windows install half-crippled by default?
>
> For several reasons:
> 1. Python can be used just fine without being on PATH. Python
>    scripts run fine both when double-clicked and when invoked in
>    the command line, and if you want to use an interactive
>    interpreter, you can find it readily on the Start menu.

Yet many scripts and applications require parameters, or to be executed
from a certain directory. For example, setup.py. Or the various
turbogears scripts. Or easy_install.

> 2. Many windows users (including myself) dislike setup routines that
>    manipulate PATH.

My opinion is that this is not as big a problem as some may feel that
it is. Unlike Unix systems, the PATH variable is rarely used. Most
applications are launched via the Start Menu, which uses absolute
paths, or via file associations, also done via absolute paths. The
chance of a naming collision only really arises when you start using
the command line, which most people don't do.

However, among those who will use the command line, are some people new
to Python, who will come across instructions like this:

<http://docs.python.org/inst/standard-install.html>

"As described in section 1.2, building and installing a module
distribution using the Distutils is usually one simple command:

python setup.py install

On Unix, you'd run this command from a shell prompt; on Windows, you
have to open a command prompt window (``DOS box'') and do it there; "

Pretty much none of the instructions in that part of the docs will work
without you altering your path beforehand. Python's cross-platform
nature means people rightly expect the same instructions to work on
Linux and Windows from a standard installation. Right now, they don't.

> if Python is to be found in PATH, it
>    should rather be installed to a directory that is known to live
>    on PATH (or where CreateProcess searches, anyway, such
>    as system32). So if the installer had such a feature, it should
>    be optional, and it should default to "off".

It's a lot more anti-social to install to system32 than to modify the
PATH variable. How easy is it to temporarily undo an installation to a
system directory like that? What if you still want Python in your path
but with less precedence than some other user directory?

> 3. Most importantly: it is difficult to implement, and nobody has
>    contributed code to make it work.

There appears to be a freely-available binary at this address that may
suffice:
http://legroom.net/modules.php?op=modload&name=Open_Source&file=index&page=software&app=modpath

-- 
Ben Sizer




More information about the Python-list mailing list