debian 12 bookworm安装python 2.7
cassandra 2.2 依赖python2.7,但debian 12开始官方源已经不再提供python2
一、从源码编译安装
- 安装编译依赖
1 | $ sudo apt update |
- 从官方下载解压源码
1 | $ wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz |
- 配置编译参数
1 | $ ./configure --prefix=/opt/python --enable-unicode=ucs4 |
编译
1
2$ make -j$(nproc)
$ sudo make install创建链接
1 | $ sudo ln -s /opt/python/bin/python2.7 /usr/local/bin/python |
二、从buster官方源安装
debian在一定程度上是可以混源安装的
/etc/apt/sources.list
中添加buster源
1 | deb https://mirrors.163.com/debian/ buster main |
然后
1 | $ sudo apt update |
安装完python后,注释掉buster源,然后apt update
,以免引起其他混乱。
References: