The initialization of the sys.path module search path — Python 3.14.7 documentation

docs.python.org

Tin mới

importlib.metadata – Accessing package metadata

Python Language Services

Python Module Index

3.14.7 Documentation

The Python Standard Library

Virtual Environments¶

A module search path is initialized when Python starts. This module search path may be accessed at sys.path.

Virtual Environments¶

A module search path is initialized when Python starts. This module search path may be accessed at sys.path.

site: Module responsible for site-specific configuration.

PYTHONPATH will affect all installed Python versions/environments. Be wary of setting this in your shell profile or global environment variables. The site module offers more nuanced techniques as mentioned below.

Virtual Environments¶

A module search path is initialized when Python starts. This module search path may be accessed at sys.path.

venv: Creation of virtual environments.

There are other ways how “virtual environments” could be implemented, this documentation refers implementations based on the pyvenv.cfg mechanism, such as venv. Most virtual environment implementations follow the model s

Py_InitializeFromConfig()

If Python is embedded within another application Py_InitializeFromConfig() and the PyConfig structure can be used to initialize Python. The path specific details are described at Python Path Configuration.

Python Path Configuration

If Python is embedded within another application Py_InitializeFromConfig() and the PyConfig structure can be used to initialize Python. The path specific details are described at Python Path Configuration.

Using Python on Unix platforms