{"id":21111,"date":"2023-09-30T11:15:55","date_gmt":"2023-09-30T11:15:55","guid":{"rendered":"https:\/\/linuxways.net\/?p=21111"},"modified":"2023-09-30T11:15:55","modified_gmt":"2023-09-30T11:15:55","slug":"how-do-i-update-my-python-version-in-ubuntu","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-do-i-update-my-python-version-in-ubuntu\/","title":{"rendered":"How do I Update my Python Version in Ubuntu?"},"content":{"rendered":"<p>Python is the most used programming language at present for Task Automation, Developing Data-Centric Software Systems, and Data Visualization. It is also used as a scripting language and it provides an Object-Oriented Programming Approach. Updating Python to the latest version ensures the compatibility of packages and stability of the Ubuntu system.<\/p>\n<p>This article elaborates on the process of updating Python to the Latest Version in Ubuntu.<\/p>\n<h2><strong>How do I Update my Python Version in Ubuntu?<\/strong><\/h2>\n<p>Ubuntu Repositories do not usually contain updated versions of a package and due to update delay you might get the updated version later on in the future. To manually get the latest Python Version, follow the steps below.<\/p>\n<h3><strong>Step 1: Check Existing Python Version<\/strong><\/h3>\n<p>Let\u2019s first check the already installed Python version using the following \u201cpython\u201d command:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"109\" class=\"wp-image-21112\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-1.png 739w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-1-300x44.png 300w\" sizes=\"auto, (max-width: 739px) 100vw, 739px\" \/><\/p>\n<h3><strong>Step 2: Update Existing Packages<\/strong><\/h3>\n<p>Before Updating Python ensure all of your packages are up-to-date using the update and upgrade commands:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update <span class=\"sy0\">&amp;&amp;<\/span> <span class=\"kw2\">sudo<\/span> apt upgrade<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"479\" class=\"wp-image-21113\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-2.png 736w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-2-300x195.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<h3><strong>Step 3: Add the \u201cSoftware Properties Common\u201d Tool<\/strong><\/h3>\n<p>The \u201cSoftware Properties Common\u201d tool manages the software repositories. With this tool, you can add, manage, enable, or disable any software repository. To install the \u201cSoftware Properties Common\u201d tool, use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> software-properties-common<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"107\" class=\"wp-image-21114\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-3.png 736w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-3-300x44.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<h3><strong>Step 4: Install CA Certificates<\/strong><\/h3>\n<p>The CA Certificate verifies the identity of 3rd party applications and encrypts the data between the 3rd party application and your system. To install CA Certificates use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> <span class=\"re5\">-reinstall<\/span> ca-certificates<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"324\" class=\"wp-image-21115\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-4.png 727w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-4-300x134.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/p>\n<h3><strong>Step 5: Add the Repository<\/strong><\/h3>\n<p>Once the CA Certificates are validated, add the Python repository which will also inform you if any recent packages are available for Ubuntu. Add the repository using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">add-apt-repository ppa:deadsnakes<span class=\"sy0\">\/<\/span>ppa<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"189\" class=\"wp-image-21116\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-5.png 730w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-5-300x78.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>It will ask for package installation confirmation, press \u201c<strong>Enter<\/strong>\u201d to continue:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"282\" class=\"wp-image-21117\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-6.png 732w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-6-300x116.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/p>\n<h3><strong>Step 6: Renew Cache and Search for the Newest Version<\/strong><\/h3>\n<p>Search the Package with the apt-cache command. The \u201capt-cache\u201d is a local database of packages and to search for a specific package we can use the \u201csearch\u201d command with it:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get update<\/span> <span class=\"sy0\">&amp;&amp;<\/span> <span class=\"kw2\">apt-cache search<\/span> python3.1<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"335\" class=\"wp-image-21118\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-7.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-7-300x139.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>The \u201capt-cache search\u201d returns the latest available version. In our case its \u201c<strong>python3.12<\/strong>\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"347\" class=\"wp-image-21119\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-8.png 727w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-8-300x143.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/p>\n<h3><strong>Step 7: Install the Latest Python Version<\/strong><\/h3>\n<p>Install the latest version now using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> python3.12<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"288\" class=\"wp-image-21120\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-9.png 744w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-9-300x116.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\n<p>It will ask for confirmation to add the packages as additional disk space will be used. Enter \u201c<strong>Y<\/strong>\u201d and click \u201cEnter\u201d to continue installing \u201cpython3.12\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"161\" class=\"wp-image-21121\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-10.png 725w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-10-300x67.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<h3><strong>Step 8: Create a Symbolic Link for Python<\/strong><\/h3>\n<p>After the python3.12 installs, create a symbolic link for the new Python Library. The Symbolic Link refers to the files and directories in Ubuntu as a single file for ease of access. Create a Symbolic Link for Python that acts as a shortcut key to the file and folder using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">ln<\/span> <span class=\"re5\">-s<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span>python3.12 <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span>python<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"36\" class=\"wp-image-21122\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-11.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-11-300x15.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<h3><strong>Step 9: Verify the Python Version<\/strong><\/h3>\n<p>Once the Latest Python Version is installed and the symbolic link for Python is created, verify the version of Python using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">python <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"718\" height=\"60\" class=\"wp-image-21123\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-12.png 718w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/09\/word-image-21111-12-300x25.png 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>This is how you can upgrade the Python version in Ubuntu.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>Python in Ubuntu can be updated using the deadsnakes repository in CLI. To Update Python, the \u201cSoftware Properties Common\u201d tool is used along with the \u201cdeadsnakes\/ppa\u201d repository. This article explained how you can update your Python to the latest version by using these tools and repositories.<\/p>","protected":false},"excerpt":{"rendered":"<p>Python is updated using the Software Properties Common tool along with the apt-cache command for searching and the \u201cdeadsnakes\/ppa\u201d repository.<\/p>","protected":false},"author":110,"featured_media":21437,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-21111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/21111","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\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=21111"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/21111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/21437"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=21111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=21111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=21111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}