[Python-Dev] Added platform-specific directories to sys.path

Barry A. Warsaw barry@zope.com
Mon, 22 Jul 2002 10:14:01 -0400


>>>>> "MH" == Michael Hudson <mwh@python.net> writes:

    >> your GvR> .profile.  Or adding them to sys.path via your
    >> $PYTHONSTARTUP file.

    MH> That only helps for interactive sessions...

Yup, which might or might not be good enough.  I'm thinking of the
(X)Emacs arrangement that there are system startup files and user
startup files that are normally always loaded, unless you use a
command line switch to specifically disable them.

    >> OTOH, it might be nice if the distutils `install' command had
    >> some switches to make installing in some of these common
    >> alternative locations a little easier.  That might dovetail
    >> nicely if/when we decide to add a site-updates directory to
    >> sys.path.

    MH> I don't see what's so very difficult about

    MH> $ python setup.py install --prefix=$HOME

Actually, to do it correctly (and quietly) this appears to be the most
accurate way to tell distutils to install a library in an alternative
search path:

% PYTHONPATH=<dir> python setup.py --quiet install --install-lib <dir> \
   --install-purelib <dir>

A bit less than intuitive than say, a standard alternative
user-centric installation directory and a --userdir option to the
install command.

-Barry