2010-04-11 4 views

Répondre

1

distutils.sysconfig est le module qui "permet d'accéder aux informations de configuration à faible niveau de Python". La fonction get_python_lib, en particulier, donne "le répertoire de l'installation de bibliothèque générale ou dépendante de la plateforme", en fonction de ses arguments. Cependant, sys.executable n'est pas exposé par ledit module sysconfig - c'est seulement dans le module sys.

+0

Merci Alex! Il semble que get_python_lib (1,1) soit exactement ce dont j'ai besoin. L'appel avec les paramètres par défaut renvoie le répertoire site_packages. –

1

Vous voulez le module sys:

>>> print sys.executable 
/usr/bin/python 
>>> print sys.path 
['', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', 
'/Library/Python/2.6/site-packages', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode'] 
+0

pas tout à fait ... Je cherche où le programme d'installation a installé les bibliothèques du système, pas les bibliothèques du système qui sont sur le chemin. –

Questions connexes