Import and Packaging Modules

venv

Creates lightweight virtual environments with their own package locations and interpreter entry points, based on an existing Python installation. Activation is optional when using the environment interpreter directly. A virtual environment is not a security sandbox or fully portable directory. The example configures an EnvBuilder but does not create an environment.

Formal Syntax & Structure

python syntaxpython
import venv

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from venv import EnvBuilderbuilder = EnvBuilder(with_pip=False, system_site_packages=False)print(builder.with_pip, builder.system_site_packages)
Python Reference