[Python-Dev] Remove site-packages?!? [was: [Distutils] PEP 376 - from pythonpkgmgr's point of view]

Glenn Maynard glenn at zewt.org
Wed Jul 22 21:45:29 CEST 2009


On Wed, Jul 22, 2009 at 10:26 AM, Tres Seaver<tseaver at palladion.com> wrote:
> You missed my point:  I know that sys.prefix etc. is set based on the
> location of the executable.  You were complaining that setuptools /
> distutils wants to put files in an "OS-controlled directory":  I was
> asking how Python was supposed to know the difference between
> /usr/lib/python2.x/site-packages (presumably "OS-controlled") and
> /opt/Python2.x/lib/python2.x/site-packages (definitely not "OS-controlled").

autoconf--for all its warts--solved this ages ago.  On installation,
you specify what prefix you want to install stuff into; if you don't,
you get a sensible default (/usr/local).  If you're creating an OS
package, or if installing directly into /usr is otherwise really what
you really want to do, you specify --prefix=/usr.  The Python core
doesn't need to know anything about this; it just needs to have a
sys.path that includes both /usr/lib/... and /usr/local/lib/....

This works for everything else--C headers, libraries, manpages, shared
libraries.  Why is Python special?

> The solution is to avoid doing distutils / setuptools operations as
> root, *ever*, and instead use either an alternate install location (such
> as /opt/Python2.x) or use something like virtualenv, which provides a
> "safe" sandbox for installing stuff.

This is nasty.  I should certainly be able to globally install
packages on my own, without creating a whole new Python installation
or other hacks, just like I can install anything else into /usr/local.

-- 
Glenn Maynard


More information about the Python-Dev mailing list