1. Install virtualenv.
pip install virtualenv
2. cd into your project directory.
cd project/
3. Create virtual environment. This will create venv
directory under your project.
virtualenv venv --python=python2.7
4. Activate virtualenv
source venv/bin/activate
Done. Install whatever package you need for your project using
pip install
More…
If you are creating a virtual environment for python3, and you have python3 at the system level, simply replace step 3 with
virtualenv venv
If you want to remove virtual environment, first deactivate it by running
deactivate
and remove the venv
directory.
rm -rf venv