I searched in my repo but couldn't find the "python2.7-dev" to install some previously built old packages by building and installing from GitHub repo. Is there a way to sideload it?
2 Answers
You can still install Python 2.7 from Debian 11. Mixing releases is typically decried as a bad idea, but that is mostly in the context of adding a newer release; adding an older (still-supported) release is much less error-prone, as long as you keep an eye on any packages apt
wants to remove.
Add a file, /etc/apt/sources.list.d/bullseye.list
, containing
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org bullseye-security main
Run sudo apt update
, and you will be able to install python2.7-dev
.
As you are probably aware, maintaining Python 2-based projects is becoming increasingly difficult, and the above won’t be a viable approach once Debian 11 is no longer supported (some would argue it already isn’t viable).
The PPA Approach
While Stephen's answer is certainly viable until Bullseye is no longer supported. I believe this approach will survive until the various python versions are removed from the PPA. Adding this PPA or Personal Package Archive, or any for that matter is relatively easy.
The PPA Specifically for Python
The Dead Snakes Personal Package Archive contains packaged versions of Python all the way back to 2.3. Add it with: sudo add-apt-repository ppa:deadsnakes/ppa
Note that these are made to work with Ubuntu, and since that's a Debian derivative:
The packages may also work on other versions of Ubuntu or Debian, but that is not tested or supported.
See also: Install newer & older versions of python on debian?. Read Gilles' answer from 8 years ago that's still quite valid.
-
deadsnakes stopped providing Python 2.7 packages a while ago, so this no longer works. Commented Aug 21 at 7:04