Install python 3.11.9 on ubuntu

Does it have to be Ubuntu 22.04 for some reason? Because if you use a later version of Ubuntu such as 23.10, or a distro with newer packages such as Fedora, you will have python 3.11 out of the box.

I’m on Linux Mint 21.1 which is based on Ubuntu 22.04. Python 3.11
is in Ubuntu’s “universe” repo and doesn’t need an additional PPA,
let alone an own build from source.

I received message:
python3.11 is already the latest version (3.11.9-1+jammy1)

So, this indicates, that Python 3.11 is already installed, and the
confusion comes from running “python3 --version” which “still”
returns “Python 3.10.12”. It’s the same (similar) here:

[1,  0] mirko@wizbox:[~]$ python3 --version
Python 3.10.6
[1,  0] mirko@wizbox:[~]$ python3.11 --version
Python 3.11.0rc1

Carefully note, that this is absolutely correct and expected –
this is, how it should be!

Most modern Linux distros use Python themself and Python 3.10.6 is
the “system’s Python”. On my (and the OP’s) system, 3.11 is
installed as an additional version.

Carefully note: Do not replace the system’s python! (symlinking,
overwriting, etc). The system itself needs 3.10, but you can have
any other python version installed additionally.

@neil

To use python 3.11, simply call “python3.11” instead of “python3”

2 Likes