Tin mới
Thread states and the global interpreter lock
Python Initialization Configuration
See Python Initialization Configuration for details on how to configure the interpreter prior to initialization.
Python has variables for the global configuration to control different features and options. By default, these flags are controlled by command line options.
filesystem encoding and error handler
This API is kept for backward compatibility: setting PyPreConfig.legacy_windows_fs_encoding should be used instead, see Python Initialization Configuration.
sys: Access system-specific parameters and functions.
This API is kept for backward compatibility: setting PyConfig.legacy_windows_stdio should be used instead, see Python Initialization Configuration.
site: Module responsible for site-specific configuration.
This API is kept for backward compatibility: setting PyConfig.site_import should be used instead, see Python Initialization Configuration.
builtins: The module that provides the built-in namespace.
Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; see Before Python Initialization for the few exceptions.
Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; see Before Python Initialization for the few exceptions.
Undo all initializations made by Py_Initialize() and subsequent use of Python/C API functions, and destroy all sub-interpreters (see Py_NewInterpreter() below) that were created and not yet destroyed since the last call
atexit: Register and execute cleanup functions.
Undo all initializations made by Py_Initialize() and subsequent use of Python/C API functions, and destroy all sub-interpreters (see Py_NewInterpreter() below) that were created and not yet destroyed since the last call
Cautions regarding runtime finalization¶
In the late stage of interpreter shutdown, after attempting to wait for non-daemon threads to exit (though this can be interrupted by KeyboardInterrupt) and running the atexit functions, the runtime is marked as finalizi
Deprecated since version 3.13, will be removed in version 3.15: Use PyConfig_Get("base_prefix") (sys.base_prefix) instead. Use PyConfig_Get("prefix") (sys.prefix) if virtual environments need to be handled.