Mark Harrison
Mark Harrison

Reputation: 304514

Python: what package contains the installation metadata?

e.g., how can I find out that the executable has been installed in "/usr/bin/python" and the library files in "/usr/lib/python2.6"?

Upvotes: 2

Views: 107

Answers (2)

Alex Martelli
Alex Martelli

Reputation: 881785

distutils.sysconfig is the module that "provides access to Python’s low-level configuration information". The get_python_lib function, in particular, gives "the directory for either the general or platform-dependent library installation", depending on its arguments.

However, sys.executable is not exposed by said sysconfig module -- it's only in the sys module.

Upvotes: 1

jemfinch
jemfinch

Reputation: 2889

You want the sys module:

>>> 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']

Upvotes: 1

Related Questions