[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)
STINNER Victor
report at bugs.python.org
Mon Jan 18 05:15:17 EST 2021
STINNER Victor <vstinner at python.org> added the comment:
On Fedora 33, the stdlib lives in two main directories:
* /usr/lib64/python3.9: Python modules
* /usr/lib64/python3.9/lib-dynload: C extension modules
Example:
>>> import os.path
>>> os.path.dirname(os.__file__) # Python
'/usr/lib64/python3.9'
>>> os.path.dirname(_asyncio.__file__)
'/usr/lib64/python3.9/lib-dynload'
The Python stdlib path can be retrieved with:
>>> import sysconfig; sysconfig.get_paths()['stdlib']
'/usr/lib64/python3.9'
But I'm not sure how to retrieve /usr/lib64/python3.9/lib-dynload path. "platstdlib" is not what I expect:
>>> import sysconfig; sysconfig.get_paths()['platstdlib']
'/usr/lib64/python3.9'
I found DESTDIR in Makefile:
>>> sysconfig.get_config_var('DESTSHARED')
'/usr/lib64/python3.9/lib-dynload'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42955>
_______________________________________
More information about the Python-bugs-list
mailing list