How to Install Python in Ubuntu

Are you looking to set up Python on your Ubuntu PC? Here’s everything you require from installation instructions to updating, and more.

Nearly every Linux distribution has a version of Python that is included in the standard package for the system. Sometimes, however, because of some reason, there may be a reason why you don’t have Python in the system of an Ubuntu system.

Let’s look at the process to set up Python on Ubuntu and provide a short guide to updating the Python package too.

How to Check if Python Is Installed on Your System

Python is a mighty, high-level scripting language that is used by a variety of developers across the world. It is a great language for a wide range of real-world applications like the development of websites, Web Scraping as well as penetration tests. It is possible to create the Telegram bot with Python.

To verify whether Python exists on the system start the terminal and press CTRL + Alt + T. Enter “python3” and then press enter.

If you can see the following output on your terminal, you’ve got Python in the Ubuntu machine.

Python 3.11.0a7 (main version, April 20 2022, 1744:14) [GCC 9.4.0 on Linux Enter "help", "copyright", "credits" or "license" to find out more. >>>

This output gives information about what version of Python that is installed on your system, as well as the date and time of the moment.

However, If you encounter an error that says “bash Python3: command not found” likely, your Ubuntu system isn’t running Python installed.

You can also verify Python version by entering the following command into your terminal:

python3 --version

The output will provide information about the versions of Python installed on your machine.

How to Install Python on Ubuntu

Installation of Python for Ubuntu is simple. It is possible to download the most current version of Python from various sources. Here are a few suggested methods to accomplish the same thing:

Install Python Using APT

APT, also known as Advanced Package Tool will be the standard manager for packages that is available on Ubuntu. It is possible to get these Python packages directly from the Ubuntu repository. Here’s how:

  1. Start your terminal with Ctrl+ALT + T.
  2. Refresh your local system’s repository list by typing this command
    sudo apt update
  3. Download the most recent Python version. Python:
    sudo an apt installation of Python3
  4. APT will find the program to install the package on your PC.

Use Deadsnakes PPA to Install Python 3 on Ubuntu

If, for any reason, you are not able to get these Python packages from official Ubuntu repositories, attempt to add your Deadsnakes PPA to your system’s repository list. PPAs is also known as Personal Package Archives are repositories specifically created for Ubuntu users.

By default, it is not possible to install PPAs onto your computer. The “software-properties-common” package provides you with an efficient way to manage and add PPAs on Ubuntu.

  1. Install the package mentioned above on your system by entering your command line:
    sudo apt install software-properties-common
  2. Include your Official Deadsnakes PPA link to your system’s repository list:
    sudo add-apt-repository ppa:deadsnakes/ppa
  3. Update your system’s list of packages:
    sudo apt update
  4. Get the most recent Python version from the added PPA: Python from the included PPA:
    sudo the apt-install command to install Python3

Because it is the case that Deadsnakes PPA has almost every version of Python in its database, you can use older versions of Python also. Simply change the name of the package to the latest version of Python you wish to download on your PC.

Install Python 3 on Ubuntu From Source Code

You can get and install the most recent version of Python on the official Python website. While the process of making the source code is a bit intimidating initially but it will become much easier once you’ve learned the procedure.

  1. Refresh your system’s Repository list local to your system:
    sudo apt update
  2. Install the necessary dependencies on your system using APT:
    sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
  3. Create a brand new directory to place all of the Python sources:
    Mkdir /python and CD the Python executable
  4. You can download your copy of the Python Source code for Python from the official FTP server. :
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0a7.tgz
  5. Download the TGZ file you just downloaded:
    tar -xvf Python-3.11.0a7.tgz
  6. You must conduct tests and optimizes before installing Python. This is crucial since it improves the speed of execution of your program by a minimum of 10 percent.
    cd Python-3.11.0a7 ./configure --enable-optimizations
  7. Create the package by using the MakeFile located within the directory
    sudo make install

Once you’ve completed these steps, make sure Python is installed on your system by entering Python3 –version in the terminal.

It is important to note the fact that Python modules are controlled by PIP. PIP is a system for managing packages. a system that is used to download and install libraries to the Python Package Index. The installation of Python PIP in your machine is crucial in case you plan to utilize additional modules for future Python projects.

Updating Python to the Latest Version

First, you must ensure that you are running an older version of Python installed on your system. You can check this by typing the Python3 –version in your terminal. Take note of the version information.

It is possible to find the most current version of Python on the internet by searching for it. A simple Google search for ” python latest version number” will suffice. If these two numbers do not coincide, then you’re probably running an older version.

Upgrade to Python’s most recent version is easy by using Ubuntu’s Advanced Package Tool. If you’ve already installed Python onto your machine with APT as well as its Deadsnakes PPA, you can use the following instruction to download the most recent Python version:

If you’ve built Python using the source code on your own, visit the Python FTP and grab a copy of the most recent version. You’ll need to follow the steps over again to build the program, however.

Running Python in Ubuntu

Python is preinstalled on nearly all Linux operating systems and is accessible in official repositories for distribution as well. If you don’t yet have Python already installed on your PC it is easy to download it with Ubuntu’s program manager.

It is the Python language is employed in many different industries, and its applications show its power of it. Programming languages are becoming essential due to the increasing demand for developers in all sectors.

Leave a Reply

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