如何在 ArchLinux 上将 python 更新到最新版本?

Rua*_*ari 5 python linux archlinux pacman-package-manager

如何3.11.0通过pacman在ArchLinux上安装最新的python版本?

ArchLinux wiki说当前版本是3.10,尽管 python 3.11 已经正式发布。

跑步时sudo pacman -Syyu p我受到欢迎warning: python-3.10.8-3 is up to date

难道我做错了什么?

小智 11

您可以使用 pyenv 独立于发行版的包管理器安装 Python 的多个版本和实现。

  1. 安装 pyenv 与sudo pacman -S pyenv.
  2. 设置 shell 以与 pyenv 一起使用https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv
  3. 安装您选择的 Python 版本(请注意,CPython 将从源代码构建)。
pyenv install -l # This will list all available versions
pyenv install 3.11.1 # This will install CPython 3.11.1
Run Code Online (Sandbox Code Playgroud)
  1. 选择Python版本作为默认版本。
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
Run Code Online (Sandbox Code Playgroud)

请注意,这不会替换由位于 的包管理器安装的 Python /usr/bin/python。Pyenv 只会更改 PATH 以指向python其 Python 二进制文件。


小智 3

使用类似“yay”的 AUR 来获取新的 python3.11。

如果您的系统上尚未安装 yay,请按照以下说明设置 yay

在系统中设置 yay 后运行此命令:

yay -S python311
Run Code Online (Sandbox Code Playgroud)