How To Install Python 3.10 on Ubuntu 18.04 or 20.04

Python is a popular high-level object-oriented programming language that is open-source and has a large community. Its popularity grows...


Python is a popular high-level object-oriented programming language that is open-source and has a large community. Its popularity grows as a result of its simplicity and easy-to-understand grammar. Python can be used to create a wide range of applications, from basic scripts to sophisticated machine learning algorithms.

Python 3.10 is the most recent release version, however it is not as stable as Python 3.9. However, the final candidate is likely to be released soon. The following features are included in Python 3.10:

  1. Ability to directly type hint lists and dictionaries.
  2. Decorators who are more adaptable
  3. Deprecated compatibility code has been removed.
  4. A Python parser with more power.
  5. HTTP status codes have been updated.
  6. Support for the correct time zone.
  7. Updates on security, etc.

The following are some of Python's most common applications:

  1. Workflows are created using this tool in conjunction with applications.
  2. Used to construct web apps on a server.
  3. Rapid prototyping or development of production-ready software.
  4. Handle large amounts of data and execute sophisticated calculations.
  5. Read and edit files via connecting to database systems.

This tutorial will show you how to install Python 3.10 on Ubuntu 18.04 or 20.04 systems. I'll show you how to install Python 3.10 on your Debian 11|10 machine using two different techniques.

  • Install Python 3.10 from the deadsnakes PPA
  • Manually build Python 3.10 from the source code

The First Steps

Make sure your system is up to date and that you have all of the necessary programmes loaded.

sudo apt update && sudo apt upgrade -y

Option 1: Using the Apt Repo, install Python 3.10 on Ubuntu 18.04 or 20.04

Installing Python 3.10 with APT on Ubuntu 18.04 or 20.04 is a breeze, thanks to the deadsnakes custom PPA! This makes it simple to set up Python on Ubuntu and receive regular updates, bug fixes, and security patches.

To add custom PPAs, you'll need to install the required requirement.

sudo apt install software-properties-common -y

Then, as shown below, add the deadsnakes PPA to your APT package management sources list.

sudo add-apt-repository ppa:deadsnakes/ppa

Press Enter to continue.

..........
To install 3rd-party Python modules, you should use the common Python packaging tools.  For an introduction into the Python packaging ecosystem and its tools, refer to the Python Packaging User Guide:
https://packaging.python.org/installing/

Sources
=======
The package sources are available at:
https://github.com/deadsnakes/

Nightly Builds
==============

For nightly builds, see ppa:deadsnakes/nightly https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly
 More info: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

With the deadsnakes repository added to your Ubuntu 18.04 or 20.04 system, now download Python 3.10 with the single command below.

sudo apt install python3.10

Dependency Tree:

...................
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.10-minimal libpython3.10-stdlib python3.10-minimal
Suggested packages:
  python3.10-venv binfmt-support
The following NEW packages will be installed:
  libpython3.10-minimal libpython3.10-stdlib python3.10 python3.10-minimal
0 upgraded, 4 newly installed, 0 to remove and 192 not upgraded.
Need to get 5,023 kB of archives.
After this operation, 19.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Verify the installation by checking the installed version.

$ python3.10 --version
3.10.0

Option 2 – Install Python 3.10 on Ubuntu 18.04 or 20.04 from Source.

Another option for installing Python 3.10 on your Ubuntu 18.04 or 20.04 machine is to compile it from source code. You will get the newest Python version using this installation technique, but you will not be able to receive ongoing updates, bug fixes, or security upgrades through the APT package management.

To build Python 3.10 from the source code, you'll need to install the necessary dependencies.

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

Now go to the Python official release page and download the most recent version of Python. Alternatively, copy the Python 3.10 gzipped tarball download link and use Wget to pull it as shown below.

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz

After you've downloaded this file, you'll need to extract it.

tar -xf Python-3.10.*.tgz

Now go to the extracted directory and execute the configure script to verify that all of the essential dependencies are present. Using the –-enable optimization flag, the binary is optimised by running numerous tests.

cd Python-3.10.*/
./configure --enable-optimizations

Output:

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.10... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out

.....................
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup.local
creating Makefile

Now initiate the Python 3.10 build process as below.

cd Python-3.10.*/
./configure --enable-optimizations

Output:

make -j 4

To make the process go faster, make sure the -j parameter matches the number of cores on your system. Using the command nproc, you may find out how many cores your machine has. In this case, my computer has two cores.

Sample Output:

....................
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  pwd                   time               

running build_scripts
copying and adjusting /home/ubuntu/Python-3.10.0/Tools/scripts/pydoc3 -> build/scripts-3.10
copying and adjusting /home/ubuntu/Python-3.10.0/Tools/scripts/idle3 -> build/scripts-3.10
copying and adjusting /home/ubuntu/Python-3.10.0/Tools/scripts/2to3 -> build/scripts-3.10
changing mode of build/scripts-3.10/pydoc3 from 644 to 755
changing mode of build/scripts-3.10/idle3 from 644 to 755
changing mode of build/scripts-3.10/2to3 from 644 to 755
renaming build/scripts-3.10/pydoc3 to build/scripts-3.10/pydoc3.10
renaming build/scripts-3.10/idle3 to build/scripts-3.10/idle3.10
renaming build/scripts-3.10/2to3 to build/scripts-3.10/2to3-3.10
make[1]: Leaving directory '/home/ubuntu/Python-3.10.0'

After the build is finished, run the make command to install Python 3.10 on Ubuntu 18.04 or 20.04.

sudo make altinstall

Here altinstall is used instead of install in order to keep the default Python binary path in /usr/bin/python.

Sample Output:

Looking in links: /tmp/tmpwbk6rtev
Processing /tmp/tmpwbk6rtev/setuptools-57.4.0-py3-none-any.whl
Processing /tmp/tmpwbk6rtev/pip-21.2.3-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /usr/local/include/python3.10/setuptools
  sysconfig: /home/ubuntu/Python-3.10.0/Include/setuptools
  WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /usr/local/include/python3.10/pip
  sysconfig: /home/ubuntu/Python-3.10.0/Include/pip
Successfully installed pip-21.2.3 setuptools-57.4.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Verify your installation.

$ python3.10 --version
Python 3.10.0

On Ubuntu 18.04 or 20.04, install Python Modules|Extensions.

Python modules and extensions are useful because they provide functionality to the language. The Python Package Manager can be used to install modules on Ubuntu 18.04 or 20.04. (PIP). PIP must be installed on your system as described here.

sudo apt install python3-pip

Then use the syntax below to install a Python module of choice.

sudo pip install module-name

In this guide, I will demonstrate how to install a Python module beautifulsoup4.

sudo pip install beautifulsoup4

Output:

Collecting beautifulsoup4
  Downloading beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 259 kB/s 
Collecting soupsieve>1.2
  Downloading soupsieve-2.2.1-py3-none-any.whl (33 kB)
Installing collected packages: soupsieve, beautifulsoup4
Successfully installed beautifulsoup4-4.10.0 soupsieve-2.2.1

You can list locally installed Python packages using the command:

$ pip list
Package                Version             
---------------------- --------------------
attrs                  19.3.0              
Automat                0.8.0               
beautifulsoup4         4.10.0              
blinker                1.4                 
certifi                2019.11.28          
chardet                3.0.4               
Click                  7.0                 
cloud-init             20.2                
colorama               0.4.3               
command-not-found      0.3                 
configobj              5.0.6               
constantly             15.1.0              
cryptography           2.8                 
dbus-python            1.2.16              
distro                 1.4.0               
distro-info            0.23ubuntu1         
entrypoints            0.3                 
httplib2               0.14.0              
hyperlink              19.0.0     
..............

That concludes the discussion. I hope you found my tutorial on installing Python 3.10 on Ubuntu 18.04 or 20.04 useful. You're now ready to utilise Python to create online apps, software, and workflows, among other things.

COMMENTS

Name

2023,2,Ai,2,AlmaLinux 9,3,Amazon Linux,5,Apache Web Server,1,AppImage,1,Arduino IDE,1,Artificial Intelligence,2,BalenaEtcher,1,Bitcoin,1,Blockchain Data,1,Bookworm,2,Bootable USB,1,C++,1,centos,1,CentOS 8,1,CentOS Stream,1,CMake,1,CockroachDB,2,cuDNN,1,Database Security,1,Debian,2,Debian 10,2,Debian 11,2,Debian 12,9,DNS,1,Docker,1,E-commerce,1,Fail2ban,1,Fedora Linux,1,Firefox 118,1,FreeIPA Server,1,Function,1,Game Projects,1,Git,3,Google PageSpeed,1,How to,5,How to Install,9,HTTPS,1,Introduction,1,Iptables,1,ISO Image,1,KVM,1,Laravel,1,Let's Encrypt SSL,1,Linux,4,Linux 6.4,1,Linux Kernel 6.5,1,Linux Mint,1,Linux Server,1,Linux-Based Systems,1,Mageia 9,1,Magento,1,MariaDB,1,Media Server,1,ModSecurity,1,New Features,1,Nextcloud,2,NGINX,2,Nvidia CUDA,1,odoo,1,Oracles,1,Performance,1,PHP Zip Module,1,pip,1,Plex,1,Port Forwarding,1,postgresql,2,Privacy,1,Programming,1,Pylint,1,python,5,Python 3.10,2,Quantum,1,Quantum Computers,1,Remote Branch,1,Renew,1,RHEL,1,Rocky Linux 9,2,Rufus,1,Shadow Password,1,SQLite,1,SSH,1,SSH key,1,SSH Keys,1,Step-by-Step,4,SuiteCRM,1,SUSE Linux,1,Syslog,1,System,1,Testing,1,Top 10,1,Translation,1,Ubuntu,1,Ubuntu 18.04,1,Ubuntu 20.04,5,Ubuntu 22.10,1,Ubuntu 23.04,1,Ubuntu Server,1,Ubuntu Upgrade,1,unsupported,1,Up-to-Date,1,Upgrade,1,Visual Studio Code,1,Vivaldi 6.2,1,Web 3.0,1,Web Hosting Security,1,Web Security,1,Webmin,1,What's New,1,Windows 11,1,
ltr
item
Linux code EDU: How To Install Python 3.10 on Ubuntu 18.04 or 20.04
How To Install Python 3.10 on Ubuntu 18.04 or 20.04
https://blogger.googleusercontent.com/img/a/AVvXsEiAuX9XiQ2l_Jco66ZwxBEChbTNtFw9O2UCTyPfmkNi5beWwhZtnYIv6qaDG6QUTIQovGZyLsd9_3Za3U-ArVuM4-IgU0uXrytHSEPG60P_FZHgpplxo_yOqGEKJhmF07OhX08vg_Wk8TtS4Hk1oJfSYbX6v9oi416YdRwALlmz8wa6pAac199KzyeEjw=s16000
https://blogger.googleusercontent.com/img/a/AVvXsEiAuX9XiQ2l_Jco66ZwxBEChbTNtFw9O2UCTyPfmkNi5beWwhZtnYIv6qaDG6QUTIQovGZyLsd9_3Za3U-ArVuM4-IgU0uXrytHSEPG60P_FZHgpplxo_yOqGEKJhmF07OhX08vg_Wk8TtS4Hk1oJfSYbX6v9oi416YdRwALlmz8wa6pAac199KzyeEjw=s72-c
Linux code EDU
https://linuxcodeedu.blogspot.com/2021/10/how-to-install-python-310-on-ubuntu.html
https://linuxcodeedu.blogspot.com/
https://linuxcodeedu.blogspot.com/
https://linuxcodeedu.blogspot.com/2021/10/how-to-install-python-310-on-ubuntu.html
true
6096992636254302192
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content