Introduction


Virtualenv is a tool that is used to isolated Python environments. It does this by creating a folder that contains all the necessary executables to use the packages that a Python project would need.


Installation


You can install virtualenv via pip

$ pip install virtualenv

Basic Usage


Create a virtual environment for a project

$ cd project_folder
$ virtualenv venv

This will create a folder in the current working directory that will contain a copy of all your python executable files from the current default python on your system

You can specify which python interpreter you’d like to use as well:

$ virtualenv -p /usr/bin/python2.7 venv

To start up your environment, activate it with the following

$ source venv/bin/activate

The name of the current virtual environment will now appear on the left of the prompt to let you know it’s active

Virtualenv


Removing environment


In order to remove and envinroment, simple rm -rf the virtualenv folder in your project; or delete the project folder all together.