In this tutorial , I am going to show you that how to Install , configure and use python virtual environment in Ubuntu . Python Virtual environment provide flexibility to switch between environments easily according to your requirements , python virtualenvs create isolated python environment which contains all project specific dependencies separately .
Please Note : These steps demonstrated and tested on Ubuntu 15.04 but they will work same on other Ubuntu and Debian based distributions .
apt-get install build-essential # Install Python Development package and pip apt-get install python2.7-dev python-setuptools sudo easy_install pip
sudo pip install virtualenv
After Install You can use
virtualenv to setup virtual environment
cd your_project_folder virtualenv venv
then activate the virtual environment
Before using virtualenv freeze pip and pipe that to requirements.txt file
pip freeze > requirements.txt
then after activation virtualenv install all dependencies using pip
pip install -r requirements.txt
additionally you can install virtualenvwrapper , which provide awesome setup of tools which make working with virtualenv easy and pleasant .
read more about virtualenvwrapper http://virtualenvwrapper.readthedocs.org/en/latest/install.html
to deactivate virtual environment :
I hope this post will help you to setup virtual environment in you system . thanks for reading .