How To Install Django 3 On Ubuntu Linux

Listen as audio

Hello Techies,

In this post, I am going to cover simple steps on how to install Django 3 on Ubuntu Linux machine.

We have to follow some basic steps whenever we create any new Django application like, do not use the same virtual environment for multiple applications. I always recommend you to use a separate virtual environment as per your project requirement. Still, confused? Okay, Don’t worry I will clear this point. Imagine a scenario where you are working on 2 different Django based projects where one project uses the Django 1.9 version  and another one uses 3.1 version so in this situation a virtual environment can be useful to  maintain the dependencies of both the projects.

I hope you’re now clear about these concepts. If so, let us now turn to our main topic, which is the How Install Django 3 on Ubuntu Linux machine.

Introduction of Django Framework

  • Django is an open-source web-based framework that is primarily based on the Python Programming language.
  • Django software foundation maintains the Django Framework.
  • Django is based on the MVT(Model-View-Template) pattern.
  • Django is a web-based application where you can develop an E-commerce site and many more.
  • Django offers many modules like Authentication, Admin Panel, Contact forms, File upload, and support, and more.
  • Today, many websites are built with Django Framework like YouTube, Instagram, Bit Bucket, Spotify, etc.

Steps : How to Install Django 3 on Ubuntu

  1. Python Installation
  2. Install django ubuntu virtualenv
  3. Pip Installation
  4. Django Installation

Update all local packages before installing Django 3 on an Ubuntu Linux machine.

sudo apt-get update

Python Installation

As we all know Django is based on the Python programming language so you must have Python installed on your machine. This is the main step of the installation process of Django 3 on Ubuntu Linux machine.

As Ubuntu machine having pre-installed python, so you can check the python version by using the below command.

 python3 -V or python3 --version

If Python 3 is not installed in your machine then for the Python installation you can use the below command.

sudo apt-get install python3

Now, Python 3 has been installed on your machine. Now let’s check which other packages required to install Django 3 on Ubuntu machine

Install django ubuntu virtualenv

Virtual Environment is a tool that helps us to maintain the dependencies as per your project requirement. This is a very important tool where all the Python Developers use it in their projects.    

Command to install Virtual Environment

sudo apt-get install virtualenv

Command to create Virtual Environment

virtualenv -p python3 env 

Command to activate Virtual Environment

source /env/bin/activate or . env/bin/activate

Command to deactivate Virtual Environment


Install pip

A pip is a python package manager where it used to install the python packages which we required in our project.

Command to install pip

sudo apt-get install python3-pip

Command to install any python package using pip

pip3 install package_name

eg. pip3 install simplejson

Command to uninstall any python package using pip

pip3 uninstall package_name

eg. pip3 uninstall simplejson

Command to check installed packages using pip

pip3 freeze

How to install django in ubuntu

Once you have activated the environment as mentioned above, the next step is to install Django 3 on ubuntu using pip.

pip3 install django

How to uninstall django in ubuntu

To uninstall the django use below command.

pip3 uninstall django

So to install Django 3 on Ubuntu Linux machine 3 things are important that are python, virtual environment, and pip and you are ready to develop your first Django project.

Command check the Django version

pip3 freeze

Hope you understand all the steps to install Django 3 on Ubuntu Linux machine. If you have any queries do comment below and Don’t forget to share this post with your friends who are facing any difficulties in the Django installation.

I have also written a post which is covering the Django installation process for windows 10 machine you can also check out that blog. In the future, if you get any chance to develop the Django application on a Windows machine so it will get easier for you. Check the below URL.

Connect with us to learn new things in Python, Django, Technology, and some Tips & Tricks about Lifestyle.

Leave a Comment