If you’ve been hearing about Django and want to start building web apps with Python, you’re in the right place. In this guide, I’ll walk you through how to install Django step-by-step — on Windows, Mac, or Linux — from scratch.
I’ll also show you how to run your first Django project, install a specific version, and fix the most common errors beginners run into.
By the end, you’ll have Django fully installed and a development server running on your machine in under 10 minutes.
What Is Django (And Why Should You Use It)?
Django is a free, open-source Python web framework that lets you build web applications fast. It’s what Instagram, Mozilla, and Pinterest were originally built on — so it’s battle-tested for large-scale apps.
Here’s why Django is worth learning in 2026:
- Batteries included — It comes with authentication, an admin panel, ORM, URL routing, and templating right out of the box
- Django 5.2 is the current LTS — Released in April 2025, it’s supported with security updates until at least April 2028
- Huge community — Tons of packages, tutorials, and Stack Overflow answers to help when you get stuck
- Fast to prototype — You can go from idea to working app in hours
What You Need Before Installing Django
Before we start, make sure you have the following:
- Python 3.10 or higher — Django 5.2 officially supports Python 3.10, 3.11, 3.12, and 3.13
- pip — Python’s package installer (comes bundled with Python 3.4+)
- A terminal or command prompt — CMD, PowerShell, Terminal, or VS Code’s integrated terminal works fine
Not sure which Python version you have? Run this:
python --version
You can refer to the screenshot below to see the output.

Or on Mac/Linux:
python3 --version
If you see Python 3.10 or above, you’re good to go.
The Right Way to Install Django (Use a Virtual Environment)
Before I show you the commands, let me tell you about the single most common beginner mistake: installing Django globally.
If you install Django system-wide without a virtual environment, you’ll run into version conflicts when you start working on multiple projects. Project A might need Django 4.2, Project B needs Django 5.2 — without a virtual environment, you can’t have both.
A virtual environment is just an isolated folder that holds the Python packages for one specific project. It keeps everything clean and separate.
💡 My rule of thumb: Every Django project gets its own virtual environment, no exceptions.
How to Install Django on Windows 10/11 (With Virtual Environment)
Step 1 — Check if Python Is Installed
Open Command Prompt (search cmd in the Start menu) and run:
python --version
If you get something like Python 3.13.2, you’re set. If not, download Python from python.org and during installation, check the box that says “Add Python to PATH” — this is important.
Step 2 — Create a Virtual Environment
Navigate to the folder where you want your Django project to live, then run:
python -m venv myenv
This creates a folder called myenv containing an isolated Python environment. You can name it anything — I usually name it venv or env.
Step 3 — Activate the Virtual Environment
Using Command Prompt:
myenv\Scripts\activate
Using PowerShell:
myenv\Scripts\Activate.ps1
⚠️ PowerShell Error Fix: If PowerShell gives you an error about execution policies, run this first:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen try activating again.
Once activated, your terminal prompt will change to show the environment name in parentheses, like this:
(myenv) C:\Users\YourName\myproject>
That prefix tells you the virtual environment is active. Any package you install now goes into myenv only — not your whole system.
Step 4 — Install Django
Now install Django using pip:
python -m pip install Django
This installs the latest stable version of Django (5.2.x as of this writing).
Step 5 — Verify the Installation
Check that Django installed correctly:
python -m django --version
You can refer to the screenshot below to see the output.

You should see something like:
5.2.1
That’s it — Django is installed on your Windows machine!
How to Install Django on Mac
Let me explain to you how to install Django on Mac.
Step 1 — Check Python Is Installed
Open Terminal (Applications → Utilities → Terminal) and run:
python3 --version
If Python isn’t installed, the easiest way on Mac is via Homebrew:
brew install python3
No Homebrew? Install it from brew.sh first.
Step 2 — Create and Activate a Virtual Environment
python3 -m venv myenv
source myenv/bin/activate
Once activated, your terminal prompt will show the environment name:
(myenv) your-mac:myproject yourname$
Step 3 — Install Django
python3 -m pip install Django
Step 4 — Verify
python3 -m django --version
Output: 5.2.1 (or similar)
💡 Note for Mac users: Always use python3 and pip3 on Mac instead of python and pip, unless you’ve set up aliases in your shell config.
How to Install Django on Linux (Ubuntu/Debian)
Here is how you can install Django on Linux.
Step 1 — Update Your Package List
sudo apt update
Step 2 — Install Python and pip if needed
Most Linux distributions come with Python pre-installed. Double check:
python3 --version
pip3 --version
If pip isn’t available:
sudo apt install python3-pip
Step 3 — Create and Activate a Virtual Environment
python3 -m venv myenv
source myenv/bin/activate
Step 4 — Install Django
pip install Django
You can refer to the screenshot below to see the output.

Step 5 — Verify
python -m django --version
How to Install a Specific Version of Django
Sometimes you need a specific Django version, maybe you’re following an older tutorial, working on a legacy project, or a client has a version requirement. Here’s how to do it:
Install a specific version:
pip install Django==5.1.4
Install from a requirements.txt file (common in team projects):
pip install -r requirements.txt
Check available Django versions:
pip index versions Django
This is useful when you want to see which patch releases are available before pinning a version.
How to Check Which Django Version Is Installed
There are two ways to check your Django version.
Option 1 — From the terminal:
python -m django --version
Option 2 — From inside Python:
python
Then in the Python shell:
>>> import django
>>> print(django.get_version())
5.2.1
How to Install Django in VS Code (Best Setup for Beginners)
VS Code is one of the most popular editors for Django development. Here’s how to set it up properly.
Step 1 — Open Your Project Folder in VS Code
code .
(If the code command isn’t available, open VS Code manually and use File → Open Folder.)
Step 2 — Open the Integrated Terminal
Go to Terminal → New Terminal from the menu bar.
Step 3 — Create and Activate Your Virtual Environment
python -m venv myenv
Windows:
myenv\Scripts\activate
Mac/Linux:
source myenv/bin/activate
Step 4 — Select the Python Interpreter in VS Code
Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) and search for “Python: Select Interpreter”. Choose the one that points to your virtual environment — it’ll show something like ./myenv/Scripts/python.exe on Windows or ./myenv/bin/python on Mac/Linux.
This step is important. If you skip it, VS Code might use the wrong Python and flag Django imports as errors even when Django is installed.
Step 5 — Install Django
pip install Django
Useful VS Code Extensions for Django Development
- Python (by Microsoft) — essential, adds IntelliSense and linting
- Django (by Baptiste Darthenay) — adds template syntax highlighting
- Pylance — faster IntelliSense for Python
How to Install Django in PyCharm
PyCharm is another solid choice, especially if you work on larger projects. Both the free Community Edition and the paid Professional Edition support Django.
Community Edition Setup
Step 1 — Create a New Project
Open PyCharm, click New Project. In the project settings:
- Set your project location
- Under Python Interpreter, choose New environment using Virtualenv
- PyCharm will automatically create the virtual environment for you
Step 2 — Install Django via the Terminal
Open the built-in terminal (View → Tool Windows → Terminal) and run:
pip install Django
Step 3 — Verify
python -m django --version
Professional Edition (Extra Feature)
PyCharm Professional has a dedicated Django project template that auto-configures settings.py, manage.py, and the project structure for you. If you’re doing serious Django development, it’s worth considering — but the Community Edition is more than enough to get started.
💡 Tip: In PyCharm, you can also install packages through the GUI. Go to File → Settings → Project → Python Interpreter and click the
+button to search for and install Django.
How to Create Your First Django Project and Run the Server
Now that Django is installed, let’s make sure everything actually works by creating a project and running the development server.
Make sure your virtual environment is still active, then run:
django-admin startproject myproject
Navigate into the newly created folder:
cd myproject
Run the development server:
python manage.py runserver
You should see output like this in your terminal:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your installation may be incomplete.
Run 'python manage.py migrate' to apply them.
May 06, 2026 - 12:00:00
Django version 5.2.1, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Open your browser and go to: http://127.0.0.1:8000/
You should see the Django rocket launch page, a green rocket, and the message “The install worked successfully! Congratulations!”
If you see that page, Django is working perfectly.
Save Your Dependencies: The requirements.txt File
Once Django is installed and working, save your project dependencies to a file:
pip freeze > requirements.txt
Open requirements.txt and you’ll see something like:
asgiref==3.8.1
Django==5.2.1
sqlparse==0.5.3
This file lets anyone else (or you, on a different machine) recreate the same environment by running:
pip install -r requirements.txt
Get into the habit of updating this file every time you install a new package. It’ll save you a lot of headaches when working in teams or deploying to a server.
Common Django Installation Errors and How to Fix Them
These are the errors I see beginners run into most often. Here they are with exact fixes:
| Error | Cause | Fix |
|---|---|---|
'django-admin' is not recognized | Virtual env not activated or PATH issue | Activate the venv first; use python -m django instead |
ModuleNotFoundError: No module named 'django' | Running Python outside the virtual env | Activate your virtual environment and reinstall Django |
pip is not recognized | Python not added to PATH | Re-run Python installer, check “Add Python to PATH” |
python is not recognized (Windows) | Python not in system PATH | Use py instead of python, or re-install Python with PATH checked |
zsh: command not found: python (Mac) | macOS defaults to python3 | Use python3 and pip3 instead |
ExecutionPolicy error (PowerShell) | Script execution is restricted | Run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser |
pip: command not found (Linux) | pip not installed | Run sudo apt install python3-pip |
| Port already in use error | Port 8000 is occupied | Run server on a different port: python manage.py runserver 8080 |
Frequently Asked Questions
Do I need to install Django globally?
No — and I’d actually recommend against it. Always install Django inside a virtual environment. Installing globally creates version conflicts when you juggle multiple projects.
Does Django come with Python?
No. Python and Django are separate. Python is the language; Django is a framework that runs on top of Python. You install Django as a package using pip after Python is already set up.
Can I install Django without pip?
Yes. You can clone the Django source code from GitHub using Git:
bashgit clone https://github.com/django/django.git python -m pip install -e django/
But honestly, just use pip. It’s simpler and handles updates cleanly.
Which version of Django should I use in 2026?
Use Django 5.2 LTS if you’re starting a new project. It’s the Long-Term Support release, meaning you’ll get security patches until at least April 2028. Avoid 3.x or 4.x for new projects — Django 4.2 LTS support ends April 2026.
Can I install multiple versions of Django on the same machine?
Yes — that’s exactly what virtual environments are for. Each environment has its own Django version. Create a separate venv per project and you’ll never have version conflicts.
What’s the difference between pip install Django and python -m pip install Django?
The second form (python -m pip install Django) is more reliable because it explicitly uses the pip associated with the Python interpreter you’re running. If you have multiple Python versions installed, this ensures you install Django into the right one.
What’s Next After Installing Django?
Now that Django is installed and running, here’s what I’d suggest doing next:
- Create your first app — Run python manage.py startapp myapp inside your project
- Learn the Django project structure — Understand what settings.py, urls.py, and
manage.pydo - Run migrations — Run python manage.py migrate to set up the default SQLite database tables
- Create a superuser — Run python manage.py createsuperuser to access the built-in admin panel at http://127.0.0.1:8000/admin/
- Build your first view — Define a URL, write a view function, and render an HTML template
Django’s official documentation at docs.djangoproject.com is genuinely excellent — I use it regularly even after years of working with Django. Start with the official tutorial called “Writing your first Django app” once you’re comfortable with the installation.
You may read:
- Use Django Built-In Login System
- Build a To-Do List API in Django Rest Framework
- Create a Notes Taking app in Django
- Retrieve GET Parameters from Django Requests

Bijay Kumar is an experienced Python and AI professional who enjoys helping developers learn modern technologies through practical tutorials and examples. His expertise includes Python development, Machine Learning, Artificial Intelligence, automation, and data analysis using libraries like Pandas, NumPy, TensorFlow, Matplotlib, SciPy, and Scikit-Learn. At PythonGuides.com, he shares in-depth guides designed for both beginners and experienced developers. More about us.