Skip to content

Instantly share code, notes, and snippets.

@genomics-geek
Last active September 25, 2016 02:57
Show Gist options
  • Save genomics-geek/07285f1310770d0e5fbe21754b5d2128 to your computer and use it in GitHub Desktop.
Save genomics-geek/07285f1310770d0e5fbe21754b5d2128 to your computer and use it in GitHub Desktop.
Guide to Virtual Environments

Guide to Virtual Environments

A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable.

For example, you can work on a project which requires Django 1.3 while also maintaining a project which requires Django 1.0.

I highly recommend using virtualenvwrapper, it makes your life so much easier!

Set up

  1. Install pip
sudo easy_install pip
  1. Install virtualenv sudo pip install virtualenv
  2. Install virtualenvwrapper sudo pip install virtualenvwrapper
  3. Set up directory
cd $HOME
mkdir .virtualenvs

Create a Virtual Environment

mkvirtualenv [virtualenv-name]

Initialize an existing Virtual Environment

workon [virtualenv-name]

Remove a Virtual Environment

rmvirtualenv [virtualenv-name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment