SIGN IN / UP
    opened image

    In this tutorial, we will look at how to install Python 3.10 on Ubuntu 20.04 or 18.04 via a ready-made repository, and install extensions/modules.

    Before installing any software, you should update repositories and install the latest versions of packages. 

     

     apt update && sudo apt upgrade -y 

     

    Install Python 3.10 from PPA repository

     

     

    To install Python 3.10 on Ubuntu 20.04 using a repository you need to add PPA repository from deadsnakes. Indeed this makes it very easy to install Python on Ubuntu  and get constant updates, bug fixes and security updates. 

    Install the necessary dependencies to add the repository. 

     

     apt install software-properties-common -y 


    Now let's add the PPA repository from deadsnakes:

     

     

     

     add-apt-repository ppa:deadsnakes/ppa 

     


    Press Enter.


     

    Now that the deadsnakes repository has been added to your Ubuntu system, we can install Python 3.10 using the command below.

     

     apt install python3.10



     

    After installation, check the installed version of Python.

     

     

     

     python3.10 --version

     


     

     

    Install Python modules in Ubuntu 20.04


    Modules and extensions are useful in Python because they add functionality to it. They can be installed using Python Package Manager (PIP). 


    Let's install it:

     

     

     apt install python3-pip



     

    Now after installing the package manager, let's install the module we need. 


    For example, to work with Telegram, let's install the following module:

     

     

     

     pip install python-telegram-bot

     





     

    To check/see what packages are installed locally, we can use the following command:

     

     

     

     

     pip list

     


    Below we can see the output of the command, and the python-telegram-bot module we installed:

     

     

     


    Now you can deploy your Python application. In the next article, we will look at how to install Python 3.10 on Centos 7.

     

    We also suggest you other useful articles: