Why do we need `virtualenv` ?

Published Jan 27, 2018
Why do we need `virtualenv` ?

Think of this situation where you are working with two applications. In one application you need x version of a library and in the second application you need y version of the application. How is it possible to install two seperate versions of a library in a machine? The solution for this problem is virtualenv. Using virtualenv you can create isolated python environment where you can install different versions of same library and which is fully isolated from the default python installation available in the system. So in the previous scenario, you can create two environments for your two projects and one env can have x version of the library and another env can have y version of the library.

How to install and use virtualenv?

Installing virtualenv

pip install virtualenv

Creating isolated environment

virtualenv env
. env/bin/activate # this will activate your env
. env/bin/deactivate # once you are done, you can deactivate env using this
Discover and read more posts from Akhil Lawrence
get started