1
1

debian11系にpython2.7をインストールする際の備忘録

Last updated at Posted at 2024-02-09

debian11系にpython2.Xをインストールする際の備忘録

※ python2.X系はもうEOLなので、python3.X系を使った方がいいです
※ 以下は妄想です

背景

ある日、debian11系にpython-devインストール試みるとエラーとなった

$ sudo apt install --yes python-dev
...
E: Package 'python-dev' has no installation candidate

debian11系以降、python-devはもはや利用可能ではないらしい

https://unix.stackexchange.com/questions/708493/python-dev-package-installation-error
python-dev is no longer available since Debian 11, Ubuntu 20.10, and any distribution derived from those.

対策

以下を参考に、こちらからソースコードをダウンロードして直接ビルド/インストールした

https://arkgame.com/2023/11/01/post-323941/

sudo apt install --yes make zlib1g-dev
curl -LO https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xf Python-2.7.18.tgz
cd Python-2.7.18
./configure
make & make install
cd ..
su ln -s /bin/python2.7 /usr/bin/python   # ここは要調整

しかし昨今の事情を踏まえると、流石にpython3.X系を使った方がいいと考える。

zlib1g-devがなくてエラー出力してしまう

以下で解決

sudo apt install --yes zlib1g-dev

makeがなくてエラー出力してしまう

以下で解決

sudo apt install --yes make

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1