Home Debian How to Install Python on Debian Linux

How to Install Python on Debian Linux

Python is an on-demand programming language that continues to grow in popularity under the Linux operating system ecosystem. Aside from its strong attributes like versatility and ease of use, mastering Python can transform the life of a Linux user for good reasons.

For instance, consider the following benefits associated with mastering Python programming language under a Linux environment:

  • Numerous job opportunities – Python is applicable in many career fields such as data analytics, Machine Learning, data science, and Artificial Intelligence.
  • Well-Paying Career – Python skills in the software development market average handsome annual salary rates.
  • Growing demand for Python Developers – Whether you are into game development, web development, or general software development, there is always something for everyone in the Python development market.

This article will walk us through the installation of Python on a Debian Linux distribution.

Install Python on Debian Using APT

Now that you have the need inspiration to start using Python, it is time to install it on your Debian system. We will use the apt package manager for the installation:

$ sudo apt install python3

The above command should install the latest stable Python3 version on your Debian system.

Install Python in Debian
Install Python in Debian

If you want to compile Python from the source to test out certain features that might not available on your distro’s package. You can easily compile the latest release of Python from the source as shown.

Install Python on Debian from the Source

First, update the Debian system and then install system dependencies.

$ sudo apt update 
$ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev 

Next, download the latest Python source release using the following wget command and install it as shown.

$ wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tar.xz
$ tar -xf Python-3.10.7.tar.xz
$ cd Python-3.10.7
$ ./configure
$ make 
$ sudo make install
$ python3 -V

Install Python Modules in Debian Using PIP

With Python successfully installed on your Debian system, you can now install various Python modules via PIP (Python package manager).

$ sudo apt install python3-pip         [On Debian, Ubuntu and Mint]
$ sudo yum install python3-pip         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a dev-lang/pip          [On Gentoo Linux]
$ sudo apk add py3-pip                 [On Alpine Linux]
$ sudo pacman -S python-pip            [On Arch Linux]
$ sudo zypper install python3-pip      [On OpenSUSE]    

Once PIP is installed, you can install any Python module using the following command.

$ python3 -m pip install module_name
Install Python Module in Debian
Install Python Module in Debian

For more usage of the Python pip command, read our article – Python PIP Cheat Sheet for Linux.

You can now explore what Python has to offer on Debian Linux.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.