Python: which package contains installation metadata?

for example, how can I tell if the executable has been installed in "/ usr / bin / python" and the library files in "/usr/lib/python2.6"?

+2


source to share


2 answers


distutils.sysconfig is a module that "provides access to Pythons' low level configuration information." The get_python_lib function , in particular, gives the "directory for a shared or platform-specific library installation", depending on its arguments.



However, sys.executable

not displayed by the specified module sysconfig

- it is only in the module sys

.

+1


source


You need a 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']
+1


source







All Articles