STINNER Victor <vstin...@python.org> added the comment:
The reference documentation for the Python Path Configuration can be found at: https://docs.python.org/dev/c-api/init_config.html#python-path-configuration Currently, Py_SetPath(path) indirectly sets the following PyConfig members: * prefix = "" * exec_prefix = "" * module_search_paths = 'path' parameter, string split at DELIM delimiter (";" character on Windows) * module_search_paths_set = 1 If you want to get the current Python Path Configuration, you can use: --- import _testinternalcapi import pprint pprint.pprint(_testinternalcapi.get_configs()) --- Example with Python 3.10 (extract): --- {'config': {... 'argv': ['x.py'], ... 'base_exec_prefix': '/usr/local', 'base_executable': '/home/vstinner/python/master/python', 'base_prefix': '/usr/local', ... 'exec_prefix': '/usr/local', 'executable': '/home/vstinner/python/master/python', ... 'home': None, ... 'module_search_paths': ['/usr/local/lib/python310.zip', '/home/vstinner/python/master/Lib', '/home/vstinner/python/master/build/lib.linux-x86_64-3.10-pydebug'], 'module_search_paths_set': 1, ... 'orig_argv': ['./python', 'x.py'], 'parse_argv': 2, ... 'pathconfig_warnings': 1, 'platlibdir': 'lib', 'prefix': '/usr/local', 'program_name': './python', ...}, ..., 'path_config': {'exec_prefix': '/usr/local', 'home': None, 'module_search_path': '/usr/local/lib/python310.zip:/home/vstinner/python/master/Lib:/home/vstinner/python/master/build/lib.linux-x86_64-3.10-pydebug', 'prefix': '/usr/local', 'program_full_path': '/home/vstinner/python/master/python', 'program_name': './python'}, ...} --- See also bpo-42260: "[C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter" which aims to rewrite the code to configure the Python Path Configuration from C to Python. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42902> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com