Install multiple Django version using virtualenvwrapper
Hi guys, Are you finding difficulties to install multiple django version and switch between them easily? Here is the way.
We can achieve this by using virtualenv and virtualenvwrapper. virtualenv allows you to set up multiple isolated Python environments and virtualenvwrapper allows create and manage multiple virtualenv seamlessly.
Here is the simple steps to setup
1) Install virtualenv and virtualenvwrapper
sudo pip install virtualenv virtualenvwrapper2) Create virtual env directory, all your environment files will be under this directory.
mkdir ~/.virtualenvs3) Set enviromental path in .bashrc file (ubuntu)
vi .bashrc, add below lines to end of the file.
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.shFor mac it will be .profile file
4) Close your terminal and open new one. Execute following command to create virtual environment
mkvirtualenv env1After the above step you see the terminal something like, terminal starting with enclosed string “env1”.
(env1)$Your virutual enviroment created andd i ready. Now you can install your Django version under env1,
Get Shabeer Ayar’s stories in your inbox
Join Medium for free to get updates from this writer.
5) Install Django 1.9
(env1)$ pip install django==1.9Above step will install django 1.9 under virtual enviroment env1, and you can access it only by virtual environment env1.
6) If you want work on django 1.7, create another virtual enviroment
mkvirtualenv env2after this command your terminal promt will be like this
(env2)$7) Install Django 1.7
(env2)$pip install django==1.78) If you want to switch to env1 , run below command
(env2)$ workon env1will result the current environment to env1,
(env1)$Using workon command you can easily switch between environments.
Now you have totally two different python environment and you can install any packanges in these environments without any conflict.
Thanks.





