

Upon adding this repository, you'll immediately receive a prompt explaining this in verbose terms. Deadsnakes carries the burden of hosting versions of Python that have been tried and tested to work on Ubuntu, (their Github organization is essentially a collection of Ubuntu-friendly Python versions).īy adding the Deadsnakes PPA, we're making these Python versions visible to our Ubuntu machines: $ sudo add-apt-repository ppa:deadsnakes/ppa Add the deadsnakes repository Python via Deadsnakesĭeadsnakes PPA is an actively maintained repository of Python distributions available to Ubuntu. We're going to walk through how to install the latest version of Python alongside Ubuntu's system Python versions safely and (relatively) easily. We can easily switch the active version of Python on our machine via a convenient CLI.

It's best to avoid messing around with your Python PATH whenever possible.We can install a new version of Python in parallel to the version of Python Ubuntu depends on, so we don't ruin our machine.Using Ubuntu's built-in alternative install is optimal for several reasons: Versions of Python installed on the same machine do not share the same core features (such as pip), which leads to a lot of confusion.Newer Python distributions aren't even visible to apt thus, we can't even use apt update to find a more recent version of Python without the help of a third party.apt upgrade does not apply to versions of Python.The risk of unintended destruction is only one of many unintuitive details that complicate the seemingly simple task of using an updated version of Python: If nobody has warned you, I'll do the honors: don't do that. But what if you've written apps intended for a newer version of Python? If you're like me, you might have tried to replace your system's default installation and destroyed your machine. Ubuntu 20.04 is the first LTS version of Ubuntu to drop Python2, coming fresh out of the box with Python 3.8.5.

Code boot camps and tutorials do a fine job of teaching students how to run Python code locally, but the most meaningful applications don't run on local machines: they run on servers, on the internet, because that's the point, isn't it? Maybe I'm taking crazy pills here. One of my earliest frustrations with Python development had nothing to do with Python itself but rather the needlessly esoteric act of deploying a Python app. If you're running Ubuntu 18.04 or older, go here. There are a number of subtle differences in managing versions of Python on older distributions of Ubuntu.
