Append module search paths for third-party packages to sys.path. **************************************************************** * This module is automatically imported during initialization. * **************************************************************** This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends lib/python<version>/site-packages. On other platforms (such as Windows), it tries each of the prefixes directly, as well as with lib/site-packages appended. The resulting directories, if they exist, are appended to sys.path, and also inspected for path configuration files. If a file named "pyvenv.cfg" exists one directory above sys.executable, sys.prefix and sys.exec_prefix are set to that directory and it is also checked for site-packages (sys.base_prefix and sys.base_exec_prefix will always be the "real" prefixes of the Python installation). If "pyvenv.cfg" (a bootstrap configuration file) contains the key "include-system-site-packages" set to "true" (case-insensitive), the system-level prefixes will still also be searched for site-packages; otherwise they won't. Two kinds of configuration files are processed in each site-packages directory: - <name>.pth files extend sys.path with additional directories (one per line). Lines starting with "import" are deprecated (see PEP 829). - <name>.start files specify startup entry points using the pkg.mod:callable syntax. These are resolved via pkgutil.resolve_name() and called with no arguments. When called from main(), all .pth path extensions are applied before any .start entry points are executed, ensuring that paths are available before startup code runs. See the documentation for the site module for full details: https://docs.python.org/3/library/site.html
© Python Software Foundation. PSF License Version 2 · Official docs ↗