I just got an Ubuntu server set up, and it seems to have come with Python 2.5. I've been developing my app in Python 2.6, but apt-cache search ^python
seems to not contain 2.6. What is the fastest way to update the repositories apt-get
looks through to include one that has Python 2.6?
(Answer mixed in reply/reply-comments: fastest way is to upgrade to Ubuntu 9.04 or later)
works for me [ jaunty ], but you might have older version of ubuntu. fiddle a bit with /etc/apt/sources.list and apt-get distr-upgrade as described here.
There is a Python 2.6 package for Ubuntu, http://packages.ubuntu.com/search?keywords=python2.6, but only for the
jaunty
andkarmic
releases. You could possibly grab the.deb
file and install it on previous versions, but things may break..If
apt-get
fails you, compiling from source is trivial:Of course you should try and install everything via your package manager (so you get automatic updates and such), but I tend to keep old versions of Python around, and putting them in
/usr/local/python/
shouldn't interfere withapt-get
at all.If a package is not available in your version of Ubuntu, it's fairly easy to backport the package from a more recent version. For example:
Let's start by installing some packages required for building any package:
Next we get the source packaging. In this case we go to http://packages.ubuntu.com/jaunty/python2.6 and look on the right and see three links under "Download Source Package". You should end up with a .tar.gz, .diff.gz and a .dsc file.
Next we unpack the source:
This will extract everything into a directory. If you change into that directory and see if we can build it with the packages we currently have installed.
This will either take some time and build you some packages in the directory above the source directory. Alternatively it will complain about missing build dependencies. If you're lucky, you can just install them and try building the package again. If you're unlucky, the package requires an updated package. You can try following the same procedure to build the build dependency or you can try changing the dependency version in debian/control. I'd only do the latter if you discover you're ending up building too many packages as the packaging hasn't been tested with those changes.
Once you've got your packages, you can run
If it complains about dependencies, you can run:
which should sort out your dependency problems. If it doesn't, you may need to back port more packages.
In Ubuntu 8.04, you might need to find a port repo to apt-get. So it's recommended to install with source code. In Ubuntu 9.04 and 10.04, python2.6 is standard.
What version of Ubuntu is it? There's an (admittedly very old) post on StackOverflow here which suggests you have to do it from source, but it depends on your version: here
The following worked for me with little variation:
optionally, you can open synaptic, refresh packages and search for python2.6. I always prefer using synaptic.