Ubuntu 24.04 安装 Python 2.7

Undefined443 / 2024-08-24 / 原文

Ubuntu 24.04 对 Python 2.7 的维护已经停止了,因此 Python 2.7 已从 Ubuntu 24.04 软件包移除。如果想要安装 Python 2.7,需要我们自己从 Python 官网下载 Python 源码并编译。

获取源码:

# 下载源码压缩包
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
# 解压
tar -xJf Python-2.7.18.tar.xz

编译:

cd Python-2.7.18
# 设置编译选项并写入 Makefile
./configure
# 编译
make

安装:

su root
make install

参考:Ubuntu 24.04 LTS安装Python2失败解决