Re: Why does Python never add itself to the Windows path?



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

.



Relevant Pages

  • Re: Windows distribution suggestions?
    ... >> You'll find a Windows installer program, ... the terrific installation jungle like registry, access restrictions, dlls ... I'd demand a fluent installation process at no cost ... I guess that neither your apps nor Python requires special folders or paths, ...
    (comp.lang.python)
  • cx_Freeze 4.1
    ... cx_Freeze is a set of scripts and modules for freezing Python scripts ... into executables in much the same way that py2exe and py2app do. ... Enabled support for compiling on 64-bit Windows. ...
    (comp.lang.python.announce)
  • Re: [Full-disclosure] WinAppDbg version 1.2 is out!
    ... The WinAppDbg python module allows developers to quickly code instrumentation ... easier to maintain or modify than other debuggers on Windows. ... test / fuzz Windows applications with quickly coded Python scripts. ... Where can I find WinAppDbg? ...
    (Full-Disclosure)
  • Re: [Full-disclosure] WinAppDbg version 1.2 is out!
    ... The WinAppDbg python module allows developers to quickly code instrumentation ... easier to maintain or modify than other debuggers on Windows. ... test / fuzz Windows applications with quickly coded Python scripts. ... Where can I find WinAppDbg? ...
    (Bugtraq)
  • [Full-disclosure] WinAppDbg module v1.1 is out!
    ... The WinAppDbg python module allows developers to quickly code ... easier to maintain or modify than other debuggers on Windows. ... test / fuzz Windows applications with quickly coded Python scripts. ...
    (Full-Disclosure)