{"id":13606,"date":"2022-01-05T01:35:23","date_gmt":"2022-01-05T01:35:23","guid":{"rendered":"https:\/\/linuxways.net\/?p=13606"},"modified":"2022-01-05T01:35:57","modified_gmt":"2022-01-05T01:35:57","slug":"how-to-install-python-3-11-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-python-3-11-on-ubuntu-20-04\/","title":{"rendered":"How to Install Python 3.11 on Ubuntu 20.04"},"content":{"rendered":"<p>Python is regarded as one of most popular , multi-purpose and beginner-friendly programming languages. It\u2019s used in a wide selection of areas including data science, machine learning, rapid prototyping, and creating web applications.<\/p>\n<p><a href=\"https:\/\/docs.python.org\/3.11\/whatsnew\/3.11.html\">Python 3.11<\/a> was released a few months ago this year, October, 2022 and provides a wide array of improvements such as faster speed of execution, better error diagnostics, and improved modules to mention just a few.<\/p>\n<p>In this guide, we will walk you through the installation of Python 3.11 on Ubuntu 20.04<\/p>\n<h2><strong>Step 1: Update the system &amp; Install dependencies<\/strong><\/h2>\n<p>As we set sail, the first step is to install dependencies that will be required during the installation of Python 3.11. But first, refresh the Ubuntu package lists as follows.<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"167\" class=\"wp-image-13607\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-83.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-83.png 723w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-83-300x69.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/strong><\/p>\n<p>Next , install the <strong>software-properties-common <\/strong>package. This provides an abstraction of APT repositories and provides some useful scripts that help you manage software applications from third-party vendors such as PPAs.<\/p>\n<pre><strong>$ sudo apt install software-properties-common<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"867\" height=\"226\" class=\"wp-image-13608\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-84.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-84.png 867w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-84-300x78.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-84-768x200.png 768w\" sizes=\"auto, (max-width: 867px) 100vw, 867px\" \/><\/strong><\/p>\n<p>Once the <strong>software-properties-common<\/strong> package is in place, let\u2019s head over to the next step.<\/p>\n<h2><strong>Step 2: Install Python3.11 on Ubuntu<\/strong><\/h2>\n<p>To successfully install Ubuntu, we need to add the <strong>deadsnakes <\/strong>PPA which provides the most recent versions of Python such as Python 3.7 and 3.8 for Ubuntu 18.04 and Python 3.9 to Python 3.11 For both Ubuntu 18.04 and Ubuntu 20.04.<\/p>\n<p>So, proceed with the addition of the <strong>deadsnakes <\/strong>PPA.<\/p>\n<pre><strong>$ sudo add-apt-repository ppa:deadsnakes\/ppa<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"345\" class=\"wp-image-13609\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-85.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-85.png 901w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-85-300x115.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-85-768x294.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><\/p>\n<p>To continue adding the PPA, proceed and hit ENTER.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"340\" class=\"wp-image-13610\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-86.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-86.png 842w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-86-300x121.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-86-768x310.png 768w\" sizes=\"auto, (max-width: 842px) 100vw, 842px\" \/><\/p>\n<p>Next, update the package lists to sync your system with the newly added <strong>deadsnakes <\/strong>PPA.<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"209\" class=\"wp-image-13611\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-87.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-87.png 749w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-87-300x84.png 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/p>\n<p>Finally, use the APT command to install Python 3.11as shown.<\/p>\n<pre><strong>$ sudo apt install python3.11<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"855\" height=\"292\" class=\"wp-image-13612\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-88.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-88.png 855w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-88-300x102.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-88-768x262.png 768w\" sizes=\"auto, (max-width: 855px) 100vw, 855px\" \/><\/p>\n<p>To confirm that Python3.11 is installed, run the command:<\/p>\n<pre><strong>$ python3.11 \u2014-version<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"122\" class=\"wp-image-13613\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-89.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-89.png 523w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-89-300x70.png 300w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/strong><\/p>\n<h2><strong>Install additional Python packages<\/strong><\/h2>\n<p>Additionally, there are some useful packages that supplement the default Python installation that you might consider installing.<\/p>\n<p>Consider installing development headers for building and compiling C extensions as follows.<\/p>\n<pre><strong>$ sudo apt install python3.11-dev<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"306\" class=\"wp-image-13614\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-90.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-90.png 877w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-90-300x105.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-90-768x268.png 768w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><\/p>\n<p>Also, consider installing the standard library `dbm.gnu` module<\/p>\n<pre><strong>$ sudo apt install python3.11-gdbm<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1028\" height=\"229\" class=\"wp-image-13615\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-91.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-91.png 1028w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-91-300x67.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-91-1024x228.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-91-768x171.png 768w\" sizes=\"auto, (max-width: 1028px) 100vw, 1028px\" \/><\/p>\n<p>And lastly, feel free to install the Python<strong> venv<\/strong> module that allows you to create virtual environments.<\/p>\n<pre><strong>$ sudo apt install python3.11-venv<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"258\" class=\"wp-image-13616\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-92.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-92.png 841w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-92-300x92.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-92-768x236.png 768w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/p>\n<p>You can also consider installing the Tkinter Python Library as shown<\/p>\n<pre><strong>$ sudo apt install python3.11-tk<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"983\" height=\"215\" class=\"wp-image-13617\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-93.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-93.png 983w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-93-300x66.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-93-768x168.png 768w\" sizes=\"auto, (max-width: 983px) 100vw, 983px\" \/><\/p>\n<h2><strong>Accessing the Python 3.11 shell<\/strong><\/h2>\n<p>To access the Python shell run the command:<\/p>\n<pre><strong>$ python3.11<\/strong><\/pre>\n<p>From here, you can run your Python code. In the snippet below, we have created and execute a simple program that sums two numbers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"271\" class=\"wp-image-13618\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-94.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-94.png 673w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-94-300x121.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>And that\u2019s it, we have managed to successfully install Python 3.11 on Ubuntu 20.04.<\/p>","protected":false},"excerpt":{"rendered":"<p>Python is regarded as one of most popular , multi-purpose and beginner-friendly programming languages. It\u2019s used in a wide selection of areas including data science, machine learning, rapid&hellip;<\/p>","protected":false},"author":1,"featured_media":13636,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[820,100],"class_list":["post-13606","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-python-3-11","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/13606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=13606"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/13606\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/13636"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=13606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=13606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=13606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}