As of Python 3.3 virtual environments have been supported from within the language as a module. See the PEP: https://www.python.org/dev/peps/pep-0405/
That means you can run the venv module like so to create a virtualenvironment:
`python python3 -m venv venv_directory_name `
Going forward this will be the best way to create these virtual environments.
Prior to PEP 405 to get a virtual environment you would typically use virtualenvwrapper. An annoyance I ran into is that the virtual environment that shipped with some versions of Ubuntu and debian is broken. Specifically I found that Ubuntu 14.04 was broken when I tried to use it:
pyvenv-3.4 ~/my_venv Error: Command '['/home/cg/my_venv/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
If interested you can see the bug report here: https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1290847 Now you can somewhat work around the issue by not using pip with the --without-pip option. But given the usefulness of pip that seems like a poor "solution" overall, especially considering the ease of updating. Luckily this isn't too difficult to fix:
sudo pip install --upgrade virtualenv
Now we should be able to create our virtualenv's if this upgrade succeeds.
virtualenv-3.4 --python=python3.4 my_env
This will create a directory called my_env that contains the virtualenvironment. Within this is the activation script.
If this has succeeded then your command prompt should change to reflect this with a prefix of (my_env)). Test that this has successfully set up the install by doing which python, if this points to the Python in the virtual environment directory all has gone well. Now if you install things with pip they will install into this virtual env. Now I personally like to keep a requirements.txt file that contains all the packages installed by pip:
pip freeze > requirements.txt
This should be all you need to do!