Sitemap

Install multiple Django version using virtualenvwrapper

2 min readJun 20, 2016

--

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 virtualenvwrapper

2) Create virtual env directory, all your environment files will be under this directory.

mkdir ~/.virtualenvs

3) 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.sh

For mac it will be .profile file

4) Close your terminal and open new one. Execute following command to create virtual environment

mkvirtualenv env1

After 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.9

Above 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 env2

after this command your terminal promt will be like this

(env2)$

7) Install Django 1.7

(env2)$pip install django==1.7

8) If you want to switch to env1 , run below command

(env2)$ workon env1

will 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.

--

--

Shabeer Ayar
Shabeer Ayar

Written by Shabeer Ayar

Building Kipe | Technical Consultant | Passionate about GenAI & Software Innovation