Install Python 3.4, Django 1.7 on Ubuntu 14.04 in a venv Virtual Environment

Python’s venv module provides support for creating lightweight “virtual environments” with their own site directories, isolated from system site directories. Each virtual environment has its own Python binary (allowing creation of environments with various Python versions) and can have its own independent set of installed Python packages in its site directories. –

It’s well worth the trouble of setting up your Django projects this way, as system updates (eg: a system Python upgrade) won’t break your “virtual” projects. The venv concept has a big advantage over a traditional virtual machine, as there are no extra resources required to run another operating system. Win!

Run the following commands at the terminal to install Python 3.4 in a “virtual environment” and install Django inside the venv.

Install python3 and curl

sudo apt-get install python3 curl -y

Go to your home directory

cd ~

Create a virtual environment called “myvenv”

pyvenv-3.4 ~/myvenv --without-pip

Activate your new virtual environment

source ~/myvenv/bin/activate

Go to your new virtual environment directory

cd ~/myvenv

Create a directory and extract the python setup tools into it

mkdir pypioffline
cd pypioffline
curl -O
tar xvzf setuptools-6.1.tar.gz

Run the setup tools

cd setuptools-6.1

Install pip

easy_install pip

Install django

pip install django

Run the Django web server

python runserver

Now visit to (hopefully) see your “Welcome to Django” page!

Other handy commands you’ll use…

Deactivate your new virtual environment


Reactivate your new virtual environment

source ~/myvenv/bin/activate

Credits: Code Ghar


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s