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

Christian Heimes lists at cheimes.de
Sun Jan 20 06:20:32 EST 2008


pythonewbie wrote:
> I am stucked on creating a function to get the Python install
> directory (and site-packages directory) with a 100% reliable method...

Only one method is 100% reliable:

try:
    import yourextension
except ImportError:
    available = False
else:
    available = True

Christian




More information about the Python-list mailing list