Does Linux have Python?

Share your love

Python is an excellent programming language used for various tasks ranging from simple automation to building advanced web applications. Another great application of Python is its support as a core technology in some Linux distributions.

On most Linux distributions, Python comes preinstalled to support core programs available on Linux operating system. Python 2 is the most common Python version that you will find on most Linux distributions. Besides, Linux supports installing new versions of Python 2 and Python 3. Thus, Linux does have Python, which usually comes preinstalled with the operating system or installed by the user.

As most of the Linux distros have Python installed, you must be curious as to why Linux must have the programming language installed by default. Well, here are the reasons why most Linux distributions have Python installed by default.

1. Python comes as a dependency for most programs used on Linux

Some programs or utilities that are core to most Linux distros depend on Python to run or operate effectively. Without Python, these programs would not execute completely or would terminate prematurely when the user makes some requests.

Thus, to support the execution of such programs, utilities, or programs on Linux, Linux must be installed. Therefore, Linux maintainers/developers prefer to add Python versions compatible with these programs/utilities.

Generally, most programs preinstalled on Linux depend on Python and mostly use Python version 2. For most recent programs/utilities, Python 3 is used as a dependency.

2. Purpose of a Linux distro may influence the use of Python to complete core tasks

Most Linux distributions are developed for specific purposes such as security and penetration testing, web development, software development, e.t.c. Kali Linux is a perfect example of a distribution explicitly developed for one purpose, where the distro has been used majorly for security and penetration testing or hacking.

Thus, Python may become the preferred programming language that supports most of the tools or programs in a specific industry. Therefore, developers of the distributions distribute the Linux operating system distro with Python because they are 100% sure that it will support programs that depend on Python to run.

Another scenario where operating system use influences the installation of Python on most Linux operating systems is programming or writing code in general. Linux distros like Ubuntu are geared toward software/web development and app deployment.

Tasks such as programming and app deployment may depend on Python to complete. For example, Python programmers or Python/Django developers will mostly use Python to complete their code writing and deployment. Most of the time, these programmers will opt to use Linux servers such as Ubuntu servers to deploy their applications. And guess what, the most commonly used programming languages are?

Well, most web servers will have web applications deployed in PHP, Nodejs, Python, e.t.c. Therefore, servers running on Linux operating systems will have Python installed, or developers must install Python to deploy their applications.

3. Some Linux distributions management tools require Python to run

Some management tools and scripts on most Linux distributions are written in Python. Thus, maintainers must ship the distributions with Python installed for management tools requiring Python to run successfully. Therefore, these Linux distros have Python as a requirement.

Management tools such as yum, NetworkManager, and DNF are written using Python. Popular Linux tools, such as Wifite and portage, are also written using Python programming languages. Thus, for these tools or programs to operate, Python is a requirement.

4. Most Linux GUIs and Window management systems are partially written in Python

Window management systems such as Xfce, Gnome, and KDE are written in Python, majorly some parts o them. For example, Gnome is written in C, XML, C++, HTML, C#, Vala, Python, CSS, and JavaScript, among other programming languages. Therefore, Python must be installed by default or as a dependency for these graphical user interfaces or window management systems to run.

5. Python’s popularity has influenced its use on most Linux systems

Python is a popular programming language that has its application in many areas. Due to its wide use, most Linux distributions prefer to install it by default, even if Python may not be required. The assumption is that most of the Linux users using their distributions are more likely to install and use Python.

How to install Python on Linux

Now that you understand the reasons behind Python preinstallation on Linux operating systems let’s see how you can install Python on a Linux machine.

Sometimes, the only Python version available to your Linux OS may be Python 2, which has been depreciated. Thus, you may need to install Python 3 to do specific tasks, such as programming, when you are using Python to write code.

With that said, you must install Python. But, you may not know how to do it. Thus, you can follow this simple and fast guide to install the latest version of Python on Linux.

Open a new Terminal window and update your Linux system by typing the following:

sudo apt update && sudo apt upgrade -y

After a successful upgrade, install the latest Python version on your Linux system by typing the following command:

sudo apt install python3

That’s it. You should have the latest Python 3 installed on your system and ready to start using it.

If you want an in-depth tutorial on installing Python on Linux, I have created a resource for you in this article.

Related Questions

Is Python better on Linux or Windows?

It is absolutely better to use Python on Linux than on Windows due to the advantages and opportunities that Linux provides. Linux is a very efficient operating system that performs faster due to its lack of bloatware applications, consumption of too many computer resources such as RAM, and prevalence of security issues such as malware and viruses.

While using Python on Linux, you will enjoy the opportunities of smooth running programs, a requirement for fewer computer resources, and a lack of common security compromises. Therefore, you will have to focus more on writing your Python code, increasing productivity.

How do I write a Python script on Linux?

To write Python script or code on Linux, you need to use a code editor or a Python IDE. Visual Studio Code is an example of a code editor that you may use to write Python code effectively. Alternatively, you may use an IDE (Integrated Development Environment) such as Pycharm to write, debug, and test Python code on Linux.

After you write Python scripts, you may use the Terminal to execute the scripts. Besides, you may use the Terminal provided in the code editor or IDE that you are using. Visual Studio Code and PyCharm provide you with the Terminal (mostly at the bottom) to run your Python scripts as you code.

What is the best IDE to write Python code on Linux?

The best IDE to write Python code on Linux is Pycharm. Pycharm provides Linux users with various tools and features while writing their Python programs.

For example, Pycharm offers Python programmers debugging and testing tools, allowing them to write better and correct Python code. Besides, Pycharm has code autocompletion, autosuggestion, and autocorrection helping Linux programmers write code effectively and efficiently.

Another good thing is that Pycharm is installed on Linux very easily. Here are the simple steps you can take to install Pycharm on Linux:

Step 1: Head to the JetBrains download page and download the PyCharm community version under the Linux tab.

Step 2: Open the Terminal, navigate into the Downloads folder, and type the following:

cd ~/Downloads

sudo apt update

sudo apt install ./pycharm_file_name.deb

That’s it. You should have Pycharm installed on your Linux system. You can find Pycharm in the Apps list.

Alternatively, you can install Pycharm using snap. Follow these steps to install Pycharm using the snap package manager:

Step 1: Open the Terminal and update your system

sudo apt update

Step 2: Install snap package manager if you don’t have it already

sudo apt install snapd

sudo systemctl enable snapd --now

sudo ln -s /var/lib/snapd/snap /snap

Step 3: Install Pycharm using snap

sudo snap install pycharm-community --classic --edge 

You should be able to use Pycharm to write Python code on your Linux system.

There are other programs/packages that programmers/developers can use to improve their effectiveness and productivity. You may follow this link to find a helpful resource that will help you code effectively on Linux.


Linux operating systems have Python that either comes as preinstalled or user installed. For preinstalled Python, most Linux distributions use Python as a dependency. Thus, most Linux systems’ core programs and utilities effectively execute when Python is installed.

Another reason Python is installed on some Linux distros is that some distributions are developed for specific tasks requiring Python programs. For example, some penetration testing programs require Python to execute. Thus, Linux developers or maintainers provide Python by default.

The other reason is that Linux users must install Python to be able to complete their needs. Such users include programmers, network engineers, web developers, e.t.c. Without Python, these users may not be able to complete their daily tasks. Thus, the need to install Python on Linux.

That’s it for this article.

See you next time.

Share your love

Badi here, creator of— A website dedicated to providing helpful information and how-to's of web development and hosting. Inspired by a fascination to write the most efficient code to make a computer laugh, & humans, Steve has a passion for organizing characters to create code and informative content.
What makes me happy?
Well, nothing like the feeling of finally figuring out that one pesky bug that's been driving me crazy.

Leave a Reply

Your email address will not be published. Required fields are marked *