Open In App

How to install Python in Ubuntu?

Last Updated : 19 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Python is a popular programming language used to develop large projects as well as different software applications. To work on Python Projects, the need to have Installed Python Packages is necessary. Whatever Operating System you are using, it might be Windows, Linux, or MacOS, having a downloaded Python Package is necessary.

However, an inbuilt Python Package on Ubuntu is present to make the ready for working on Python Language. But in the Latest Ubuntu Version 23.10, Installation of Python is necessary to work on it. To Install Python in Ubuntu, we can use different methods in the Linux Terminal or the Command Line Tool.

In this article, we will discuss those handful of methods to get Python in the Ubuntu Operating System without consuming much time.

Quick Preview to Install Python on Ubuntu:

  1. Open Linux Terminal.
  2. Execute the command sudo apt update.
  3. Run the Python Installer Command sudo apt install python[version number]

Methods to Install Python on Ubuntu

To Download & Install Python Modules on Ubuntu, the following methods can be used. We will start with the APT Installer Method.

Method 1: Install Python on Ubuntu using APT Installer

Step 1: Open the Linux Terminal & execute the following Linux Command that will update all the packages installed there.

Command: sudo apt update

install Python in Ubuntu

Step 2: Now, directly paste the following command in the Terminal & execute it. It will directly download the latest Python File.

Command: sudo apt install python[version number]

install Python in Ubuntu

Congratulations! These simple two commands are enough to Have Python Installed on Ubuntu without any issues.

Method 2: Install Python on Ubuntu using Repository

Step 1: On the Linux Terminal, the following command will be used. It will start accessing the Repository of the Python Module.

Command: sudo apt install software-properties-common

install Python in Ubuntu

Step 2: Now, the following command execution will Download the Python Package on the device.

Command: sudo add-apt-repository ppa:deadsnakes/ppa

install Python in Ubuntu

Step 3: Execute the following command to get any version of Python, even some older ones on your Ubuntu device.

Command: sudo apt install python[version number]

install Python in Ubuntu

Hence, we have successfully installed Python on Ubuntu using Repository Module.

Step 1: Browse to the Official Python Page & copy the Gzipped Source Tarball link for any version.

install Python in Ubuntu

Step 2: Paste the link in the Linux Terminal as the following.

Command: sudo wget <Copied Link>

install Python in Ubuntu

Step 3: Extract the Downloaded TGZ File using the following Linux Command.

Command: tar -xf <TGZ File Name>.tgz

install Python in Ubuntu

Step 4: Now, the following command should be executed to Configure the extracted file before installation.

Command: ./configure --enable-optimizations

install Python in Ubuntu

Step 5: At last, the following command will be used to Directly Install the file on the system.

Command: sudo make install

install Python in Ubuntu

Conclusion

As we can see, there are possible three methods present to execute Python on Ubuntu after installing it successfully. The three methods to start Python on Ubuntu are different from each other. Even some methods take two or three steps to complete. As per your choice pick up the method to work on Python in Ubuntu.

How to install Python in Ubuntu?- FAQs

How to Install Python on Ubuntu?

The steps required to install Python on Ubuntu, the following steps should be executed.

  1. Open Linux Terminal.
  2. Execute command sudo apt install software-properties-common.
  3. Run the command sudo add-apt-repository ppa:deadsnakes/ppa to download a file from the repository.
  4. Execute command sudo apt install python[version-name]

How to check the Installed Python Version on Ubuntu?

If you have already installed a Python Package on Ubuntu or you suspect there might be a Python package already installed on the device, the best way to check its version. To check the version of the installed Python Module, the python –version command should be executed.

What if I try to install a Python Package still after having one?

If you have a Python Module present in the device & still you are installing another one, it will not cause any issues. Rather, when you put the first command to install Python, it will flag one error. From that error, you can eventually understand, that Python is already present on the device.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads