---
title: Update Python 3 on Debian
url: https://docs.vultr.com/update-python3-on-debian
description: Learn how to update Python 3 on Debian with step-by-step instructions. Discover the best methods to upgrade your Python version safely and efficiently.
publish_date: 2021-08-10T00:00:00Z
last_updated: 2026-04-15T00:00:00.077250Z
author: Kenn Carlo Gutierrez
header_image: https://docs.vultr.com/public/doc-assets/975/46f9983034f2a983.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

## Introduction

This article explains how to install the latest version of Python3 from source code on Debian 10.

## Prerequisites

* Deploy a [Vultr Debian 10](https://console.vultr.com/deploy/) VPS instance.
* Login as **root**.
* [Update the Debian server.](https://docs.vultr.com/how-to-update-a-vultr-cloud-server#how-to-update-debian--ubuntu)

## 1. Check the Installed Version

Check the installed Python3 version.

    # python3 -V

You will see something like this.

    Python 3.7.3

If your version is older than your application requires, proceed with this guide.

## 2. Update Python3

1. Install the required dependencies to compile the Python source code.

        # apt-get install wget build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev liblzma-dev -y

1. Visit [Python's Source Code Download page](https://www.python.org/downloads/source/) to find the latest gzipped source release. Replace the URLs and filenames in this guide with the latest version.
1. Download the latest Python3 source code.

        # wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz

1. Extract the downloaded python source code archive.

        # tar xzf Python-3.9.6.tgz

1. Compile the python source code.

        # cd Python-3.9.6 && ./configure --enable-optimizations

1. Install Python.

        # make altinstall

1. Check the name of your new Python executable.

        # ls /usr/local/bin/python*

1. Set the new Python executable as default. Replace the two instances of `/python3.9` in the following command with the name of your new Python executable.

        # update-alternatives --install /usr/bin/python python /usr/local/bin/python3.9 1

## 2. Update Pip

1. Update pip. Use the name of your new Python executable in the following command.

        # /usr/local/bin/python3.9 -m pip install --upgrade pip

1. Check the name of your new pip executable.

        # ls /usr/local/bin/pip*

1. Set the new pip as the default. Use the name of your new pip executable in the following command.

        # update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.9 1

1. Check the current version of Python and pip.

        # python -V && pip -V

    You will see something like this:

        Python 3.9.6
        pip 21.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

## Conclusion

Keeping your Python up-to-date is an important part of the development process. It provides bug fixes compared to older versions, and more importantly, it introduces new features and optimizations.
