How to install python on debian 12: A step-by-step guide

December 26, 2023 / Web Development

Python is a powerful programming language suitable for beginners and experts alike. This guide provides detailed instructions for installing Python on Debian 12, using both default repositories and external PPAs.

In this guide, you will learn to install Python on Debian 12.

Follow the steps:

  1. Update the Package List
    Ensure your package list is up-to-date. Open the terminal and type:
    sudo apt update
    This command updates your local software repository index.
  2. Check the Available Python Version
    Verify the Python version available in the repositories:
    apt show python3
  3. Install Python
    To install Python, run:
    sudo apt install python3
    You will be prompted for your password to initiate the installation.
  4. Verify the Installation
    Confirm the installation by checking the Python version:
    python3 –version
  5. Installing Additional Python Versions via Deadsnakes PPA
    If you need an older version, you can use the Deadsnakes PPA:

    1. Install Required Software
      sudo apt install software-properties-common
    2. Add the Deadsnakes PPA
      sudo add-apt-repository ppa:deadsnakes/ppa
      Press [ENTER] to proceed.
    3. Update the Package List Again
      sudo apt update
    4. Install the Desired Python Version for Python 3.8:
      sudo apt install python3.8
    5. Confirm the Installation Check the installed version:
      python3.8 –version

Troubleshooting Common Issues

If you encounter errors during installation, check the following:

  1. Ensure your system is fully updated.
  2. Verify your internet connection.

Conclusion:

Installing Python on Debian 12 is straightforward. Whether you need the latest version or an older release, this guide covers all the necessary steps.

If your version is different, change ‘3.8’ to match your installed version number. For  Information, you can visit our knowledge base section.

Spread the love