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

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 20 17:19:47 EST 2008


> But for different reasons I also want to get the absolute path of
> Python install directory (not only the executable under Linux) and
> site-packages directory.

The Python install directory is available as sys.prefix. The
site-packages directory is
sys.prefix+"lib/python"+x.y+"/site-packages (where x.y is from
sys.version_info).

HTH,
Martin



More information about the Python-list mailing list