We always use different version of libraries in our projects as per requirement, it means we need project environments supporting local installation of packages and avoid usage of globally installed packages. virtualenv i.e. Virtual Environment, is solutions to above problem as it maintain a separate copy of Python and libs utilized in your python project. Let’s try installtion and create a simple virtual environment using following steps.
- Installation –
sudo pip installvirtualenv
- Create new environment for a project – virtualenv envname
- activate your new env by running commands –
- Mac OS/ Ubuntu – source envname/bin/activate