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

docs.python.org

Tin mới

importlib.metadata – Accessing package metadata

Python Language Services

Python Module Index

3.16.0a0 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 “virtual environments” could be implemented. This documentation refers to implementations based on the pyvenv.cfg mechanism, such as venv, that many virtual environment implementations follow.

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