Python Virtual Environment Creator
virtualenv creates isolated Python environments, each with its own Python executable and independent set of modules installable via pip. Virtual environments can be created without root access.
Description
virtualenv is a tool to create isolated Python environments, enabling developers to work with different sets of Python modules without conflicts. Each virtual environment operates independently with its own Python executable and pip-installed packages. This isolation is particularly useful for projects requiring specific package versions or testing different Python configurations.
Unlike the built-in venv module (available since Python 3.3), virtualenv offers superior performance through app-data seed methods, greater extensibility, support for arbitrarily installed Python versions with automatic discovery, and a richer programmatic API. The tool includes a command-line script for easy environment creation and management.
Virtual Python instances created by virtualenv do not require root privileges, making it ideal for multi-user systems or restricted environments. The python3-virtualenv package provides the core functionality, while the virtualenv dependency package serves as a meta-package.
How It Works
virtualenv creates isolated Python environments by copying or symlinking the Python interpreter and establishing separate site-packages directories. It uses a creator mechanism (builtin, cpython3-posix, or venv) to construct the environment structure in the specified destination directory. Seeders (app-data or pip) populate the environment with essential packages like pip and setuptools using cached wheels or PyPI downloads. The tool discovers target Python interpreters via builtin discovery, supporting version specifiers and custom interpreter paths. Activation scripts for various shells (bash, fish, powershell, etc.) modify the shell environment to use the virtual environment's Python executable and paths.
Installation
sudo apt install python3-virtualenvFlags
Examples
virtualenv -hvirtualenv /path/to/myenvvirtualenv -p python3.11 myprojectvirtualenv --system-site-packages shared_envvirtualenv --no-pip --no-setuptools bare_envvirtualenv --creator=venv --seeder=pip myvenvvirtualenv --symlinks --clear existing_env