Python 发布 Python 3.13.0

编程语言 2024-10-11 33 次浏览 0 条评论 次点赞

Python 3.13.0

2024 年 10 月 7 日,Python 发布最新稳定版本 Python 3.13.0。Python 3.13将带来一系列令人振奋的功能和改进,将增强Python编程体验。


如何在 Linux 发行版上安装 Python 3.13


方法1:使用 Ubuntu PPA 在 Ubuntu 安装 Python 3.13

要开始安装 Python 3.13,请打开终端,将 Deadsnakes PPA 添加到系统,然后运行以下命令安装 Python 3.13 版本。Deadsnakes 维护了一个 Ubuntu PPA,以便 Ubuntu 用户更轻松地安装最新或测试版 Python。

# Adding the Deadsnakes PPA
$ sudo add-apt-repository ppa:deadsnakes/ppa

# Updating the package database
$ sudo apt update

# Installing the Python 3.13
$ sudo apt install python3.13

完成后,运行以下命令来验证 Python 版本:

$ python3.13 --version

方法2:使用源代码安装 Python 3.13

在其他 Linux 发行版中,按照以下说明从源代码安装Python 3.13。

首先,打开终端,运行其中一个合适的命令来下载并安装编译和安装 Python 3.13 所需的依赖项。

# On Debian, Ubuntu, Kali Linux, Linux Mint, Zorin OS, Pop!_OS, etc.
$ sudo apt install build-essential pkg-config

# On Red Hat, Fedora, CentOS, Rocky Linux, AlmaLinux, etc.
$ sudo dnf install groupinstall "Development Tools" pkgconfig

# On Arch Linux, Manjaro, BlackArch, Garuda, etc.
$ sudo pacman -S base-devel pkgconf

然后,转到Python 3.13 发布页面,只需向下滚动到底部,然后选择 Linux tarball 文件。

downloading-Python-3.13-source-file-1024x391.webp
下载 Python 3.13 源文件

下载完成后,转到终端,导航到下载目录,然后运行以下命令在 Linux 上构建、编译和安装 Python 3.13。

# Decompressing the tarball file and entering the extracted directory
$ tar -xf Python-*.tgz && cd Python-*/

# Configuring the package with the required dependencies
$ ./configure --enable-optimizations

# Compiling and installing Python 3.13
$ make & sudo make install

安装完成后,您可以通过检查 Python 版本来验证。

$ python3.13 --version

从 Ubuntu 和其他 Linux 发行版中卸载 Python 3.13

要删除在 Ubuntu 上使用 Deadsnakes PPA 安装的 Python,请运行:

$ sudo add-apt-repository --remove ppa:deadsnakes/ppa
$ sudo apt remove python3.13
$ sudo apt autoremove

要卸载从源代码构建的 Python,请运行此命令。

$ sudo find /usr/local/ -name "*python*3.13*" | sudo xargs -n 1 -tp rm -rf

👍

本文由 CulmartPlay 整理发布,参考 CC-BY-SA 3.0 协议共享,欢迎转载、引用或改编。
感谢您的支持,以共同推动STEM公益教育!

楼主残忍的关闭了评论