Setting up Python Virtual Environment using Command Line

It is easy to set up virtual environments using an IDE such as PyCharm, but here is how to do it with the command line. Here the virtual environment is called ‘gummienv’.
First set up a directory and cd into it.

$ mkdir gummi
$ cd gummi/
$ sudo pip install virtualenv
$ virtualenv gummienv,

Activate the virtual environment using,

$ source gummienv/bin/activate

Notice the name of the virtual environment is now in the command line prompt.

The virtual environment can be deactivated with,

$ deactivate