How to update python to the latest version on ArchLinux?

Question:

How to install the latest python version 3.11.0 on ArchLinux through pacman?

ArchLinux wiki says current version is 3.10, although python 3.11 has been officially released.

When running sudo pacman -Syyu p I’m welcomed with warning: python-3.10.8-3 is up to date.

Am I doing something wrong?

Asked By: Ruan Molinari

||

Answers:

Use AUR like "yay" to get the new python3.11.

If you haven’t installed yay on your system, setup yay by following these instructions

Run this command after setting up yay in your system:

yay -S python311
Answered By: Imagine Eyes

You can update python to the latest version on ArchLinux using the following command:

pacman -Syu python

Answered By: ANISH SAJI KUMAR

You can install multiple versions and implementations of Python independently of your distro’s package manager using pyenv.

  1. Install pyenv with sudo pacman -S pyenv.
  2. Set up your shell for usage with pyenv https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv
  3. Install the Python version of your choice (please note that CPython will be built from source).
pyenv install -l # This will list all available versions
pyenv install 3.11.1 # This will install CPython 3.11.1
  1. Select the Python version as the default.
pyenv shell 3.11.1 # Use this version only for this shell session
pyenv local 3.11.1 # Use this version only when you are in this directory
pyenv global 3.11.1 # Use this version as the default version

Note that this will not replace Python installed by the package manager located at /usr/bin/python. Pyenv will only change the PATH to point python to its Python binary.

Answered By: user18686221