2

I'm working on an Ubuntu 20.04 machine and need to ensure that I have the latest version of Python installed. How can I install it and make sure that it's set as the default Python version for all users on the system?

I've tried using the package manager to install Python, but it only installs an older version. I've also tried compiling from source, but that doesn't seem to work either.

Any help would be greatly appreciated. Thanks!

Lucas Miller
  • 21
  • 1
  • 4

1 Answers1

5

First of all: NEVER change the default version of Python that ships with the Ubuntu release. Parts of the system rely on this specific Python version. Changing the version may result in all types of errors up to a not anymore working Ubuntu installation.

However, it is very easy to install multiple Python major release parallel without conflicting each other. They just have to be called by stating the specific version, e.g. python3.11 for Python 3.11.

This can be achieved by compiling and installing Python yourself. The process is pretty easy and straight forward.

A step-by-step instruction can be found at ubuntuhandbook.org: Link

The really important step in the process is to use sudo make altinstall after running .\configure, as altinstall ensure that the default Python version is not overwritten.

noisefloor
  • 1,086