# virtualenv: Python Virtual Environment Tool


virtualenv creates isolated Python virtual environments. Virtual environments are self-contained directories that contain a Python installation for a particular version of Python, plus additional packages.

## When to use virtualenv

virtualenv fits projects that need broader Python version support than the standard library's [venv](https://pydevtools.com/handbook/reference/venv.md) module offers, or that benefit from its faster environment creation through cached seed packages. Most modern projects on Python 3.3 or later can use venv, which ships in the standard library and covers the same core workflow without an extra dependency. For new work, [uv](https://pydevtools.com/handbook/reference/uv.md) creates and manages [virtual environments](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md) automatically as part of its run and sync commands, removing most of the manual steps either tool requires.

### Core Functionality

- Creates isolated Python environments with their own site directories
- Installs [pip](https://pydevtools.com/handbook/reference/pip.md) into virtual environments for package management
- Provides activation scripts to easily switch between environments
- Supports multiple Python interpreters and versions

### Design Philosophy
virtualenv solves dependency conflicts and version management by providing isolation between Python environments. Each environment maintains its own independent set of Python packages that won't interfere with the global Python installation or other virtual environments.

### What virtualenv Doesn't Handle

- Installing Python versions (use tools like [pyenv](https://pydevtools.com/handbook/reference/pyenv.md) or [uv](https://pydevtools.com/handbook/reference/uv.md) for this)
- Project dependency management (use pip or other package managers)
- Packaging and distribution of Python applications
- Environment activation across different shell sessions

## Pros

- Lightweight and focused on one core task
- Stable
- Well-integrated with pip and the Python ecosystem

## Cons
- Manual environment activation required
- No automatic dependency management
- Can be confusing for beginners
- Limited project management features
- No built-in support for project requirements files
- Requires understanding of Python environments

## Learn More
- [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](https://pydevtools.com/handbook/reference/venv.md) reference
- [Official Documentation](https://virtualenv.pypa.io/)
- [Python Packaging User Guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)
- [Real Python Tutorial on Virtual Environments](https://realpython.com/python-virtual-environments-a-primer/)
