Home > google app engine, python, ubuntu > Install Python 3.2 and/or Python 2.5 on Ubuntu 11.04

Install Python 3.2 and/or Python 2.5 on Ubuntu 11.04

Update (20121120): Google App Engine supports Python 2.7 so there is no need any more to install Python 2.5. I consider this post outdated.

Chad Lung has a nice post on installing Python 3.2 from source on Ubuntu 11.04. The future versions of Ubuntu will come with Python 3, so maybe it’s a good time to start to discover Python 3 a bit.


The package “python3.2” exists in the Ubuntu repositories but it’s not up-to-date. If you want the latest version of Python, you’ll have to install it from source.

If you install Python 3.2 from source, make sure to install it with “./configure; make; sudo make altinstall“, where the emphasis is on altinstall. This way Python 3.2 will be installed next to your existing 2.x version(s), so your system won’t be messed up.

To figure out your exact Python version, you can do this:

>>> import sys
>>> print(sys.version_info[:])
(3, 2, 0, 'final', 0)

Install Python 2.5 (update, 20110926)

Edit (20111112): Google App Engine now supports Python 2.7! At the moment it’s experimental but it works. So it’s very likely you don’t need Python 2.5 at all.

I wanted to try Google App Engline but it runs on Python 2.5 on the production servers at Google. So it’s better to test your applications locally with Python 2.5 too, otherwise there is a good chance that you develop something that runs fine on your machine but breaks at Google.

So, how to install Python 2.5 keeping the newer Python versions too? I tried the method that I described above with version 3.2 but “make” failed. But in this post I found a PPA from where you can install Python 2.5 easily. Steps to follow:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5

Now if you want to use Python 2.5, just modify the first line of your scripts:

#!/usr/bin/env python2.5

Update: I figured out how to compile 2.5 from source. “make” produced the following error message: “/usr/include/sqlite3.h: version 3.7.4”. After “configure”, open Makefile and edit this line:

# before:
# after:
LDFLAGS= -L/usr/lib/i386-linux-gnu

After this compilation was done successfully with “make”. This tip is from here.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: