Install Python

Install Python on Windows, macOS, and Linux; add it to PATH; verify your installation; and understand which versions are compatible with recent Django releases.

1. Introduction

In this guide we will install Python 3.11 specifically for our Django tutorials. The goal is to keep your setup stable and consistent with the lessons, even if newer Python releases are available.

Before you begin, make sure you know which operating system you are using and that you have permission to install software on it.

  • Have a working internet connection and a few hundred MB of free disk space.
  • Know how to open a terminal or command prompt on your system.

2. Why we use Python 3.11

The latest Python on your system might be 3.13, but for this Django tutorial series we use Python 3.11. The reason is simple — 3.11 is widely supported by the Django ecosystem and common libraries, which means fewer surprises and a smoother learning path.

  • Better compatibility — packages like database drivers, image libraries, and async tools support 3.11 everywhere.
  • Stable for teaching — your screens and results will match the examples in these tutorials, which makes debugging easier.
  • Fast enough — 3.11 already brings solid performance improvements over older versions.
  • Long support horizon — 3.11 receives security updates until October 2027.

3. Avoid the latest or beta versions

Newer releases or betas can break package installs or cause small behavior changes that slow you down while learning. Stick with 3.11 for now.

  • Some packages have not built wheels yet for the newest Python, which leads to install errors.
  • Your output and error messages will match the tutorial examples if we use the same version.
  • Fewer breaking changes while you are still learning the basics.

4. Download Python 3.11

Download Python 3.11 from the official Python website. Always use the official source — avoid third party download sites.

Python 3.11.10 download page
  1. Open the link above and scroll down to the Files section at the bottom of the page.
  2. Pick the correct file for your system:
    • Windows: python-3.11.10-amd64.exe (64-bit installer)
    • macOS: python-3.11.10-macos11.pkg (universal installer)
    • Linux: use your package manager or pyenv — covered in section 7 below
  3. Save the file to your Downloads folder and move to the section for your operating system.

5. Install on Windows

Run the installer you downloaded and follow these steps carefully.

  1. Double-click the .exe file to open the installer.
  2. On the first screen, check "Add Python 3.11 to PATH". Do not skip this — without it, your terminal will not find Python.
  3. Click Install Now and allow any permission prompts.
  4. If you see a "Disable path length limit" button at the end, click it. This prevents issues with long file paths in Windows.
  5. Open Command Prompt and verify:
    py --version
    # Expected output: Python 3.11.10
    
    py -m pip --version
    # Expected output: pip 24.x.x from ... (python 3.11)

6. Install on macOS

macOS comes with an older system Python that you should not use for development. Install 3.11 separately using the official installer.

  1. Open the downloaded .pkg file and follow the on-screen steps.
  2. Allow the installer to make changes when prompted.
  3. Open Terminal and verify:
    python3.11 --version
    # Expected output: Python 3.11.10
    
    python3.11 -m pip --version
    # Expected output: pip 24.x.x from ... (python 3.11)

7. Install on Linux

On Linux, use your package manager if Python 3.11 is available. If not, use pyenv — it lets you install any Python version cleanly without touching your system Python.

Ubuntu 22.04 or later / Debian 12 or later

sudo apt update
sudo apt install -y python3.11 python3.11-venv python3.11-dev

# Verify
python3.11 --version
python3.11 -m pip --version

Fedora / RHEL / CentOS

sudo dnf install -y python3.11 python3.11-pip python3.11-devel

# Verify
python3.11 --version
python3.11 -m pip --version

Older Ubuntu / any distro — use pyenv

If Python 3.11 is not available in your package manager, pyenv is the cleanest option.

# Install pyenv dependencies first
sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev liblzma-dev

# Install pyenv
curl https://pyenv.run | bash

# Add to your shell config (~/.bashrc or ~/.zshrc)
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# Reload your shell
source ~/.bashrc

# Install Python 3.11
pyenv install 3.11.10

# Verify
pyenv shell 3.11.10
python --version

8. Next steps

Python 3.11 is installed. The next step is to create a virtual environment so your Django project has its own isolated space for packages. This keeps things clean and avoids conflicts with other projects on your machine.


Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.