virtualenvwrapper

6.1.1 · active · verified Thu Apr 16

virtualenvwrapper is a set of extensions for Ian Bicking's virtualenv tool, designed to simplify the management of Python virtual environments. It organizes all environments in one place, provides wrappers for creating, copying, and deleting environments, and enables quick switching between them with tab completion. The current version is 6.1.1, and it is actively maintained with a focus on modern Python versions.

Common errors

Warnings

Install

Quickstart

This quickstart guides you through installing virtualenvwrapper, configuring your shell, creating your first virtual environment, installing a package, and switching between environments. It's crucial to correctly source the virtualenvwrapper.sh script in your shell's startup file.

# 1. Install virtualenvwrapper (if not already done)
pip install virtualenvwrapper

# 2. Add configuration to your shell startup file (e.g., ~/.bashrc or ~/.zshrc)
#    Replace '/usr/bin/python3' with the path to your desired Python 3 interpreter if different.
#    Replace 'virtualenvwrapper.sh' path if it's not found in default user-base bin.
#    Example for .bashrc or .zshrc:
#    export WORKON_HOME=$HOME/.virtualenvs
#    mkdir -p $WORKON_HOME
#    export VIRTUALENVWRAPPER_PYTHON=$(which python3)
#    source $(python3 -m site --user-base)/bin/virtualenvwrapper.sh

# 3. Reload your shell configuration (or open a new terminal)
source ~/.bashrc # or source ~/.zshrc

# 4. Create a new virtual environment
mkvirtualenv myproject_env

# 5. Verify the active environment
workon

# 6. Install packages in the active environment
pip install requests

# 7. Deactivate the environment
deactivate

# 8. Switch to another environment (or reactivate)
workon myproject_env

view raw JSON →