{"id":161416,"date":"2026-03-16T18:51:22","date_gmt":"2026-03-16T15:51:22","guid":{"rendered":"https:\/\/cloudspinx.com\/?p=71519"},"modified":"2026-03-21T19:15:48","modified_gmt":"2026-03-21T16:15:48","slug":"how-to-install-python-on-ubuntu","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/how-to-install-python-on-ubuntu\/","title":{"rendered":"How To Install Python 3.13 on Ubuntu 24.04|22.04"},"content":{"rendered":"\n<p>Python is an open-source high-level programming language with a large community. It is one of the world&#8217;s popular programming languages used a key among the top tech companies like google to build all kinds of applications.<\/p>\n\n\n\n<p>The latest stable release version of Python is 3.13 released on <strong>October 7, 2024<\/strong>. It comes with innumerable improvements and features such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A brand-new, enhanced interactive interpreter built on top of PyPy that offers colorized exception tracebacks, multi-line editing, and color support.<\/li>\n\n\n\n<li>An experimental free-threaded build mode that permits threads to operate more concurrently by turning off the Global Interpreter Lock. The Windows and macOS installers also offer the build mode as an experimental feature.<\/li>\n\n\n\n<li>An experimental, preliminary JIT that lays the foundation for major performance gains.<\/li>\n\n\n\n<li>Debuggers can now work more reliably because the locals() builtin function (and its C equivalent) has clearly stated semantics when changing the returned mapping.<\/li>\n\n\n\n<li>Now included is a modified version of mimalloc, which is necessary for the free-threaded build mode and optional but enabled by default if the platform supports it.<\/li>\n\n\n\n<li>The leading indentation of docstrings has been removed, which lowers memory usage and the size of.pyc files. (The majority of docstring handling utilities already remove the leading indentation.)<\/li>\n\n\n\n<li>When generating new files, the dbm module&#8217;s new dbm.sqlite3 backend is utilized by default.<\/li>\n\n\n\n<li>MacOS 10.9 was no longer the minimum supported version; instead, it is now 10.13 (High Sierra). In the future, older macOS versions will not be supported.<\/li>\n<\/ul>\n\n\n\n<p>This guide illustrates two methods of how to install Python 3.13 on Ubuntu 24.04|22.04.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install Python 3.13 from the deadsnakes <strong>PPA<\/strong><\/li>\n\n\n\n<li>Manually build Python 3.13 from the <strong>source code<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Option 1- Install Python 3.13 on Ubuntu 24.04|22.04 with APT<\/h4>\n\n\n\n<p>Python 3.13 can be downloaded on Ubuntu 24.04|22.04 using a simple APT command. This is a straightforward process and takes the shortest time to complete.<\/p>\n\n\n\n<p>First and foremost, update your APT package index and install the required dependencies.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update -y\nsudo apt install software-properties-common -y<\/code><\/pre>\n\n\n\n<p>Then proceed and add the deadsnakes PPA repository to your Ubuntu 24.04|22.04 system as below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo add-apt-repository ppa:deadsnakes\/ppa<\/code><\/pre>\n\n\n\n<p>Press <strong>Enter<\/strong> to continue when prompted.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...................\nThird-Party Python Modules\n==========================\n\nPython modules in the official Ubuntu repositories are packaged to work with the Python interpreters from the official repositories. Accordingly, they generally won't work with the Python interpreters from this PPA. As an exception, pure-Python modules for Python 3 will work, but any compiled extension modules won't.\n\nTo 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:\nhttps:&#47;&#47;packaging.python.org\/installing\/\n\nSources\n=======\nThe package sources are available at:\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">https:\/\/github.com\/deadsnakes\/<\/mark><\/strong>\n\nNightly Builds\n==============\n\nFor nightly builds, see ppa:deadsnakes\/nightly https:\/\/launchpad.net\/~deadsnakes\/+archive\/ubuntu\/nightly\nMore info: https:\/\/launchpad.net\/~deadsnakes\/+archive\/ubuntu\/ppa\nAdding repository.\nPress &#91;ENTER] to continue or Ctrl-c to cancel.\nHit:1 http:\/\/ke.archive.ubuntu.com\/ubuntu noble InRelease\nHit:2 http:\/\/ke.archive.ubuntu.com\/ubuntu noble-updates InRelease                                    \nHit:3 http:\/\/ke.archive.ubuntu.com\/ubuntu noble-backports InRelease                                  \nHit:4 http:\/\/security.ubuntu.com\/ubuntu noble-security InRelease                                     \nGet:5 https:\/\/ppa.launchpadcontent.net\/deadsnakes\/ppa\/ubuntu noble InRelease &#91;17.8 kB]        \nGet:6 https:\/\/ppa.launchpadcontent.net\/deadsnakes\/ppa\/ubuntu noble\/main amd64 Packages &#91;29.1 kB]\nGet:7 https:\/\/ppa.launchpadcontent.net\/deadsnakes\/ppa\/ubuntu noble\/main Translation-en &#91;5408 B]\nFetched 52.4 kB in 2s (24.4 kB\/s)\nReading package lists... Done<\/code><\/pre>\n\n\n\n<p>Now with the deadsnakes repository added, we install Python 3.13 with the single command below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install python3.13<\/code><\/pre>\n\n\n\n<p>Dependency Tree:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n  libpython3.13-stdlib\nSuggested packages:\n  python3.13-venv binutils\nThe following NEW packages will be installed:\n  libpython3.13-stdlib python3.13\n0 upgraded, 2 newly installed, 0 to remove and 105 not upgraded.\nNeed to get 5182 kB of archives.\nAfter this operation, 21.5 MB of additional disk space will be used.\nDo you want to continue? &#91;Y\/n] <strong><span class=\"has-inline-color has-luminous-vivid-amber-color\">y<\/span><\/strong><\/code><\/pre>\n\n\n\n<p>Check the installed version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">python3.13 --version<\/mark>\nPython 3.13.2<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Option 2 &#8211; Install Python 3.13 on Ubuntu 24.04|22.04 from Source.<\/h4>\n\n\n\n<p>With this installation method, you will be guaranteed the latest Python Version although you won&#8217;t be able to maintain your package installation through the <strong>APT<\/strong> package manager.<\/p>\n\n\n\n<p>Begin by installing the required dependencies to build Python from the source code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update -y\nsudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev<\/code><\/pre>\n\n\n\n<p>Now proceed and download the latest release version of Python from the <a href=\"https:\/\/www.python.org\/downloads\/source\/\" target=\"_blank\" rel=\"noreferrer noopener\">official Python downloads page<\/a>. As of this article, the latest release version was at <strong>3.13.2<\/strong>. You can alternatively obtain the download link and pull the source code with <strong>Wget<\/strong> as below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir tmp &amp;&amp; cd tmp\nsudo wget https:\/\/www.python.org\/ftp\/python\/3.13.2\/Python-3.13.2.tgz<\/code><\/pre>\n\n\n\n<p>With the download complete, extract the <strong>Gzipped<\/strong> archive as below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xf Python-*.tgz<\/code><\/pre>\n\n\n\n<p>Now navigate into the extracted directory and run the <code>configure<\/code> script which performs checks to ensure that all the required dependencies are installed on your system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd Python-3.13*\/\n.\/configure --enable-optimizations<\/code><\/pre>\n\n\n\n<p>The <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">--enable optimization<\/mark><\/code> flag is used to optimize the binary by running multiple tests.<\/p>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>checking build system type... x86_64-pc-linux-gnu\nchecking host system type... x86_64-pc-linux-gnu\nchecking for Python interpreter freezing... .\/_bootstrap_python\nchecking for python3.13... no\nchecking for python3.13... no\nchecking for python3.12... python3.12\nchecking Python for regen version... Python 3.12.3\nchecking for pkg-config... no\nchecking MACHDEP... \"linux\"\nchecking for --enable-universalsdk... no\nchecking for --with-universal-archs... no\nchecking for --with-app-store-compliance... not patching for app store compliance\nchecking for gcc... gcc\n.....................\nconfigure: creating .\/config.status\nconfig.status: creating Makefile.pre\nconfig.status: creating Misc\/python.pc\nconfig.status: creating Misc\/python-embed.pc\nconfig.status: creating Misc\/python-config.sh\nconfig.status: creating Modules\/Setup.bootstrap\nconfig.status: creating Modules\/Setup.stdlib\nconfig.status: creating Modules\/ld_so_aix\nconfig.status: creating pyconfig.h\nconfigure: creating Modules\/Setup.local\nconfigure: creating Makefile<\/code><\/pre>\n\n\n\n<p>Now initiate the <strong>Python 3.13<\/strong> build process.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make<\/code><\/pre>\n\n\n\n<p>For faster building, you are required to modify the <code>-j<\/code> argument to match the number of cores in your processor. Find the number of processors on your system using the<code>nproc<\/code>command.<\/p>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Running code to generate profile data (this can take a while):\n# First, we need to create a clean build with profile generation\n# enabled.\nmake profile-gen-stamp\nmake&#91;1]: Entering directory '\/home\/cloudspinx\/tmp\/Python-3.13.2'\nmake clean\nmake&#91;2]: Entering directory '\/home\/cloudspinx\/tmp\/Python-3.13.2'\nfind . -depth -name '__pycache__' -exec rm -rf {} ';'\nfind . -name '*.py&#91;co]' -exec rm -f {} ';'\nfind . -name '*.&#91;oa]' -exec rm -f {} ';'\nfind . -name '*.s&#91;ol]' -exec rm -f {} ';'\nfind . -name '*.so.&#91;0-9]*.&#91;0-9]*' -exec rm -f {} ';'\nfind . -name '*.lto' -exec rm -f {} ';'\nfind . -name '*.wasm' -exec rm -f {} ';'\nfind . -name '*.lst' -exec rm -f {} ';'\nfind build -name 'fficonfig.h' -exec rm -f {} ';' || true\nfind: \u2018build\u2019: No such file or directory\nfind build -name '*.py' -exec rm -f {} ';' || true\nfind: \u2018build\u2019: No such file or directory\nfind build -name '*.py&#91;co]' -exec rm -f {} ';' || true\nfind: \u2018build\u2019: No such file or directory\nrm -f pybuilddir.txt\nrm -f _bootstrap_python\nrm -f python.html python*.js python.data python*.symbols python*.map\nrm -f .\/usr\/local\/lib\/python3.13\/os.py\nrm -f Programs\/_testembed Programs\/_freeze_module\nrm -rf Python\/deepfreeze\nrm -f Python\/frozen_modules\/*.h\nrm -f Python\/frozen_modules\/MANIFEST\nrm -f jit_stencils.h\n....<\/code><\/pre>\n\n\n\n<p>With the build process complete, install Python 3.9 on Ubuntu 24.04|22.04 using the make command below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make altinstall<\/code><\/pre>\n\n\n\n<p>Here, we are using <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">altinstal<\/mark><\/code> instead of <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">install<\/mark><\/code> because we will overwrite the system&#8217;s default Python binary path in <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">\/usr\/bin\/python<\/mark><\/code>.<\/p>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Creating directory \/usr\/local\/share\/man\/man1\n\/usr\/bin\/install -c -m 644 .\/Misc\/python.man \\\n\t\/usr\/local\/share\/man\/man1\/python3.13.1\nif test \"xupgrade\" != \"xno\"  ; then \\\n\tcase upgrade in \\\n\t\tupgrade) ensurepip=\"--altinstall --upgrade\" ;; \\\n\t\tinstall|*) ensurepip=\"--altinstall\" ;; \\\n\tesac; \\\n\t .\/python -E -m ensurepip \\\n\t\t$ensurepip --root=\/ ; \\\nfi\nLooking in links: \/tmp\/tmpt8iwo_8c\nProcessing \/tmp\/tmpt8iwo_8c\/pip-24.3.1-py3-none-any.whl\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">Installing collected packages: pip\nSuccessfully installed pip-24.3.1<\/mark><\/strong>\nWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https:\/\/pip.pypa.io\/warnings\/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.<\/code><\/pre>\n\n\n\n<p>Now verify your installation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">python3.13 --version<\/mark>\nPython 3.13.2<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install Modules|Extensions in Python<\/h4>\n\n\n\n<p>Modules can be installed using the Python Package manager (PIP). You will simply need the syntax below to get a module installed on your system. You will need to have PIP installed on your system<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install python3-pip<\/code><\/pre>\n\n\n\n<p>Then use pip to install a Python module<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pip install module-name<\/code><\/pre>\n\n\n\n<p>Let&#8217;s say we want to install the module <strong>beautifulsoup4<\/strong> we will issue the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pip install beautifulsoup4<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Collecting beautifulsoup4\n  Downloading beautifulsoup4-4.13.3-py3-none-any.whl.metadata (3.8 kB)\nCollecting soupsieve&gt;1.2 (from beautifulsoup4)\n  Downloading soupsieve-2.6-py3-none-any.whl.metadata (4.6 kB)\nCollecting typing-extensions&gt;=4.0.0 (from beautifulsoup4)\n  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)\nDownloading beautifulsoup4-4.13.3-py3-none-any.whl (186 kB)\n   \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 186.0\/186.0 kB 642.3 kB\/s eta 0:00:00\nDownloading soupsieve-2.6-py3-none-any.whl (36 kB)\nDownloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)\nInstalling collected packages: typing-extensions, soupsieve, beautifulsoup4\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-7-color\">Successfully installed beautifulsoup4-4.13.3 soupsieve-2.6 typing-extensions-4.12.2<\/mark><\/strong><\/code><\/pre>\n\n\n\n<p>List locally installed Python packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <span class=\"has-inline-color has-luminous-vivid-amber-color\">pip list<\/span>\nPackage               Version\n--------------------- --------------\nattrs                 23.2.0\nAutomat               22.10.0\nBabel                 2.10.3\nbcc                   0.29.1\nbcrypt                3.2.2\nbeautifulsoup4        4.13.3\nblinker               1.7.0\nboto3                 1.34.46\nbotocore              1.34.46\ncertifi               2023.11.17\nchardet               5.2.0\nclick                 8.1.6\ncloud-init            24.4\ncolorama              0.4.6\ncommand-not-found     0.3\nconfigobj             5.0.8\nconstantly            23.10.4\ncryptography          41.0.7\ndbus-python           1.3.2\ndistro                1.9.0\ndistro-info           1.7+build1\nhttplib2              0.20.4\nhyperlink             21.0.0\nidna                  3.6\nincremental           22.10.0\nJinja2                3.1.2\n...<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>That is it! We have come to the end of this guide on how to install Python 3.13 on Ubuntu 24.04|22.04. I have given two alternatives to get Python 3.13 installed on your Ubuntu 24.04|22.04 system. I hope you found it helpful.<\/p>\n\n\n\n<p>See more on this page:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-install-python-3-13-on-amazon-linux\/\">How To Install Python 3.13 on Amazon Linux<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/install-python-debian\/\">How To Install Python 3.13 on Debian<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-install-python-3-13-on-rocky-linux-almalinux\/\">How To Install Python 3.13 on Rocky Linux \/ AlmaLinux<\/a><\/li>\n<\/ul>\n\n","protected":false},"excerpt":{"rendered":"<p>Python is an open-source high-level programming language with a large community. It is one of the world&#8217;s popular programming languages used a key among the top tech companies like google to build all kinds of applications. The latest stable release version of Python is 3.13 released on October 7, 2024. It comes with innumerable improvements &#8230; <a title=\"How To Install Python 3.13 on Ubuntu 24.04|22.04\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/how-to-install-python-on-ubuntu\/\" aria-label=\"Read more about How To Install Python 3.13 on Ubuntu 24.04|22.04\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":161590,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[299,47,50,68,81],"tags":[39652,2254],"cfg_series":[],"class_list":["post-161416","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","category-linux","category-linux-tutorials","category-programming","category-ubuntu","tag-python-3-13","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/161416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=161416"}],"version-history":[{"count":1,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/161416\/revisions"}],"predecessor-version":[{"id":163190,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/161416\/revisions\/163190"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/161590"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=161416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=161416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=161416"},{"taxonomy":"cfg_series","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/cfg_series?post=161416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}