Key benefits of using Virtualenv

After learning how to install Virtualenv, let's have a look at some the key features that sets it apart from the rest:

It also possible to use both the system-wide and Virtualenv packages and make them work together when accessed from Virtualenv.

By using the --system-site-packages flag, we can create a virtual environment to make the environment use the global site-packages modules instead of the built-in modules as demonstrated:

virtualenv --system-site-packages env2

Another way around it is to create a symbolic link of the system directory in the local directory:

sudo ln -s /usr/lib/python3.6/dist-packages/cupy ~/env/lib/python3.6/site-packages

In a system where CuPy is installed system-wide, a virtual environment can also make good use of it through the newly created symbolic link.

A few alternatives to Virtualenv for creating and managing isolated virtual environments are pipenv and pyenv.