Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.96 KB

use-virtualenvwrapper.md

File metadata and controls

68 lines (52 loc) · 1.96 KB

title: Use virtualenv + virtualenvwrapper with Python updated: 2013-07-14 10:00:00 description: Virtualenv allows you to make isolated working copies of Python so that you can work on a specific project without affecting other projects. Virtualenvwrapper provides commands that make it simple to create and manage your virtual environments. os: [macosx, linux, windows] tags: [python] deps: [install-python] contributors: ["http://www.github.com/sloria"]

Install the packages.

$ pip install virtualenv
$ pip install virtualenvwrapper

Open your shell's profile config (e.g. .bash_profile, .bashrc, or .zshrc). This is usually located in your home directory.

Then add the following:

# ~/.bash_profile

# Enable virtualenvwrapper 
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh

On Window, you can use the virtualenvwrapper-powershell.

# Virtualenvwrapper-powershell in Windows
PS> pip install virtualenvwrapper-powershell
PS> $env:WORKON_HOME="~/Envs"
PS> mkdir $env:WORKON_HOME
PS> import-module virtualenvwrapper

Create the folder for your virtual environments.

# Reload your profile
$ source ~/.bash_profile
# Create your env directory
$ mkdir -p $WORKON_HOME

Now, when you log in to a new shell session, you will be able to use virtualenvwrapper.

# Create a new environment
$ mkvirtualenv my-fresh-environment
# Activate an environment
$ workon my-fresh-environment
# List environments
$ lsvirtualenv
# Remove an environment
$ rmvirtualenv my-polluted-environment

See also: