04 Jul 2018, 17:39


Python requires lots of libraries in its usage, sometimes its not possible or convenient to install this in the system directly.

Luckily there is a python tool that lets you circumvent this rather easily, virtualenv

If possible I find it convenient to install this tool with the systems package manager, sometimes this isn't possible either so then it can be installed locally

Creation of environment

LocalInstall of virtualenv

Go to downloadpage and download desired version of the package

Unpack the files in an desired location:

tar xz < virtualenv-16.0.0.tar.gz

Enter the folder and use the command to create an python virtual environment:

cd virtualenv-16.0.0
python virtualenv.py testing_env

Systeminstall of virtualenv

Use your systems packagemanager to install virtualenv and then simply run in wherever desired to create an environment:

virtualenv testing_env

Using the created environment

Activate the environment:

. ./testing_env/bin/activate

Its now possible to install packages locally with pip into the activated environment:

pip install docutils

Any python code running now till have access to the docutils library without needing to install it in the system or require elevated permissions

To disengage the virtualenv: