78

According to https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuDesktop "Python 2.6 is no longer available for install".

I need to support legacy software that runs only on Python 2.6. How can I install Python 2.6 on Ubuntu 12.04?

Braiam
  • 67,791
  • 32
  • 179
  • 269
lofidevops
  • 20,924

8 Answers8

89

I'm using a PPA: https://launchpad.net/~fkrull/+archive/deadsnakes

Install the PPA:

sudo add-apt-repository ppa:fkrull/deadsnakes

Run Update:

sudo apt-get update

Install your flavor:

sudo apt-get install python2.6 python2.6-dev

localhost
  • 1,093
  • 2
    I've added a PPA with rebuilds of just the Oneiric python2.6 on Precise, for anyone who doesn't want the rest of the PPA above: https://launchpad.net/~j5-dev/+archive/python2.6 – David Fraser Jul 03 '12 at 02:55
  • 3
    j5-dev throws "Not Found", fkrull is very well supported – chachan May 27 '14 at 10:49
12

Check out pythonbrew. It does a great job of managing multiple python versions and enviroments. It builds each version of python from source, but does so in a user friendly way. After you install it just run:

pythonbrew install 2.6
pythonbrew switch 2.6

Then you can use it with virtualenv to create a virtual enviroment with whatever frameworks and libraries you need without having to worry about conflicts.

8

I looked for a PPA, didn't find any, then installed Python 2.6 packages from 11.10 by hand:

cd /tmp
wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/python2.6_2.6.7-4ubuntu1_i386.deb
wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/python2.6-minimal_2.6.7-4ubuntu1_i386.deb
wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/python2.6-dev_2.6.7-4ubuntu1_i386.deb
wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/python2.6-dbg_2.6.7-4ubuntu1_i386.deb
wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/libpython2.6_2.6.7-4ubuntu1_i386.deb
dpkg -i *python2.6*_2.6.7-4ubuntu1_i386.deb

Replace XX with your country code, and, if necessary, i386 with your architecture (amd64 for 64-bit installs).

(Also, most people don't need the -dbg package.)

  • 5
    For anyone wanting to download in one command (so you can replace the country and architecture in one go):

    wget http://XX.archive.ubuntu.com/ubuntu/pool/main/p/python2.6/{python2.6{,-minimal,-dev,-dbg},libpython2.6}_2.6.7-4ubuntu1_i386.deb

    – David Fraser Apr 30 '12 at 09:20
  • For me, it downloads i368 regardless of using amd64 in the URL... EDIT: Nevermind, silly mistake. – Ken Kinder Apr 30 '12 at 16:43
  • 1
    I've added a PPA with rebuilds of these on Precise: https://launchpad.net/~j5-dev/+archive/python2.6 – David Fraser Jul 03 '12 at 02:54
1

Python isn't too hard to build. Try sudo apt-get install build-essential, sudo apt-get build-dep python2.7 (only gets dependencies which are almost the same as those for Python 2.6. Now download the Python 2.6 source distribution and ./configure, make, make install.

  • 1
    But Ubuntu patches Python in various ways. I've seen reports where upstream Python 2.6 built on Ubuntu not sure which version (11.10 probably?) failed to link to libssl correctly, making certain standard library modules non-functional. – Marius Gedminas Apr 26 '12 at 16:55
  • Attempting to build Python 2.6 in 12.04 results in myriad non-functional standard library packages. Without instructions on how to correct errors with building the zlib, sha, and other whack-a-mole problems, this answer is a waste of time. – Nick T Mar 10 '14 at 19:10
1

for plone development on linux, we use this buildout script: https://svn.plone.org/svn/collective/buildout/bda-naked-python/

there are buildout configuration files for python versions 2.4, 2.5, 2.6, 2.7 and 3.2.

the README tells how to use it.

1

If you are upgrading to 12.04 and already have Python 2.6 installed, it will remain installed after your upgrade.

The packages installed will be considered "local", and obviously cannot be updated with the Upgrade Manager. Source-only security fixes (if any are needed) are available from python.org.

Only those 2.6 packages that are installed will remain, any that were not installed will not be accessible. If you need them, you can get them from the Ubuntu archives following Marius' instructions.

lofidevops
  • 20,924
1

Try using the debs here (check the description dependencies as you may have a lot to download--but its all point/click debs).

Or if you got a usb with 10.04 install with software centre and make an aptoncd iso. You can open these and simply click the debs backed up within without doing a full auto install. I'm making a few to back-up the 10.04 debs as i fear they will be gone one day and 10.04 the best version in ubuntu history to date.

Eliah Kagan
  • 117,780
0

i dont know is it work or not, but you can try this:

apt-cache show python

this will show you version of the package and then try:

apt-get install packag_name=version

for getting only the available versions try this:

apt-cache policy <package_name>

make us know is it work or not...

urcm
  • 173