DebianLinuxTutorials

How To Install Python 3.9 on Debian 10

Install Python 3.9 on Debian 10

In this tutorial, we will show you how to install Python 3.9 on Debian 10. For those of you who didn’t know, Python, a versatile and powerful programming language, has become an essential tool for developers across various domains. Its simplicity, readability, and extensive ecosystem of libraries and frameworks make it a popular choice for building web applications, data analysis tools, and machine learning models. Debian 10, also known as “Buster,” is a stable and reliable Linux distribution that comes with Python 3.7 pre-installed.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Python 3.9 on a Debian 10 (Buster).

Prerequisites

  • A server running one of the following operating systems: Debian 10 (Buster).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Python 3.9 on Debian 10 Buster

Step 1. To ensure a smooth installation process, it’s crucial to update your system before installing new packages. Updating the system helps to fetch the latest package lists and upgrade any existing packages to their most recent versions. Open your terminal and run the following commands:

sudo apt update
sudo apt install software-properties-common

Step 2. Installing Python 3.9 on Debian 10.

Now we add the Deadsnakes PPA to your system:

sudo add-apt-repository ppa:deadsnakes/ppa

Once the repository is enabled you can install Python 3.9 using the following command:

sudo apt update
sudo apt install python3.9

Step 3. Check the Python Version.

At this step, you have successfully installed Python 3.9 on Debian 10 Linux. You need to type python3.9 to use this version. For example, to check the Python version run the following command:

$ python3.9 --version
Python 3.9.0+

Step 4. Create a Virtual Environment (Optional).

Virtual environments are isolated Python environments that allow you to manage dependencies separately for each project. They help avoid conflicts between different projects’ dependencies and keep your system’s Python installation clean. To create a virtual environment using Python 3.9, follow these steps:

sudo apt install python3.9-venv

Create a new virtual environment named myenv:

python3.9 -m venv myenv

Activate the virtual environment:

source myenv/bin/activate

Once activated, your terminal prompt will display the name of the virtual environment, indicating that you’re working within the isolated environment. You can now install packages specific to your project using pip without affecting the system-wide Python installation.

Congratulations! You have successfully installed Python 3. Thanks for using this tutorial for installing Python 3 on your Debian 10 system. For additional help or useful information, we recommend you check the official Python website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button