Linux/Win32 func. to get Python instdir (not exedir) + site-packages => extensions mgmt

pythonewbie eproust at
Mon Jan 21 11:38:14 CET 2008

On 21 jan, 10:34, "Diez B. Roggisch" <de... at> wrote:
> pythonewbie
> > Because the solution using distutils.sysconfig.get_python_lib() is
> > very smart !
> Depending on your goal. You said
> """
> My goal is to verify if an/several extension(s) are installed and to
> automatically install the missing ones on Linux or Win32.
> """
> This goal can't be reached with only the site-packages - because I can
> install packages somewhere else (matter of factly, this happens on debian
> for example, they've split the install-dirs and created a bunch of dirs
> under /usr/share)
> So having a method that gives you the installation root doesn't help much
> here.
> Diez


I repeat I am a newbie, so please don't be angry against me, if I say
something stupid or if I propose a method not efficient.

An easy way to get the absolute path of site-packages seems very
useful to me, in order to check anything (all extensions available and
not provided by sys.path, etc.) related to the files on the
filesystem, if necessary.

For the automatic installation of missing extensions (using admin
rights), I think that it is not difficult to do it on both

More information about the Python-list mailing list