0

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!

  • 1
    If you install any version of Python that is not the one the OS came with you will no longer have a working OS. Ubuntu needs the version it ships with for its own functions. What you can do is research and install multiple versions of Python with out changing the default. – David Apr 01 '23 at 10:20
  • 2
    Does this answer your question? [Installing python: who is deadsnakes and why should I trust them?](https://askubuntu.com/questions/1398568/installing-python-who-is-deadsnakes-and-why-should-i-trust-them). Follow the answer, and replace python3.9 with python3.11. – Archisman Panigrahi Apr 01 '23 at 12:12

1 Answers1

1

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
  • 251
  • 8