# virtualenv: Python Virtual Environment Tool


virtualenv creates isolated Python [virtual environments](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md). Each environment is a self-contained directory with its own interpreter and `site-packages`, so installed packages never affect the system Python or other projects. virtualenv predates the standard library's [venv](https://pydevtools.com/handbook/reference/venv.md) module and remains faster and more configurable.

## When to use virtualenv

virtualenv fits projects that need its faster environment creation through cached seed packages, or support for Python 2, PyPy, and other interpreters that [venv](https://pydevtools.com/handbook/reference/venv.md) does not cover. Most modern projects on Python 3.3 or later can use venv, which ships in the standard library without an extra dependency. For new work, [uv](https://pydevtools.com/handbook/reference/uv.md) creates and manages virtual environments automatically as part of `uv run` and `uv sync`, removing the manual create-and-activate steps virtualenv requires. virtualenv does not install Python itself; use [pyenv](https://pydevtools.com/handbook/reference/pyenv.md) or [uv](https://pydevtools.com/handbook/reference/uv.md) for that.

## Key Features

- Creates isolated environments with their own `site-packages`, preventing dependency conflicts between projects
- Faster environment creation than [venv](https://pydevtools.com/handbook/reference/venv.md) by caching seed packages (pip, setuptools, wheel) instead of bootstrapping them fresh each time
- Supports Python 2, PyPy, and other interpreters that venv does not
- Automatically installs [pip](https://pydevtools.com/handbook/reference/pip.md) into each new environment
- Activation scripts for bash, zsh, fish, and PowerShell

## Pros

- Faster environment creation than the built-in [venv](https://pydevtools.com/handbook/reference/venv.md) through seed package caching
- Broader interpreter support, including Python 2 and PyPy
- Stable, with a long-running plugin ecosystem

## Cons

- Manual environment activation required; no equivalent to `uv run`
- No dependency locking or Python version management (use [pip-tools](https://pydevtools.com/handbook/reference/pip-tools.md) or [uv](https://pydevtools.com/handbook/reference/uv.md) for those)
- Requires a separate install; not part of the standard library

## Learn More

- [How to create and use a Python virtual environment with venv](https://pydevtools.com/handbook/how-to/how-to-create-and-use-a-python-virtual-environment-with-venv.md)
- [What is a virtual environment?](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md)
- [Why should I use a virtual environment?](https://pydevtools.com/handbook/explanation/why-should-i-use-a-virtual-environment.md)
- [venv reference](https://pydevtools.com/handbook/reference/venv.md)
- [virtualenv documentation](https://virtualenv.pypa.io/)
