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.
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:
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: # LDFLAGS= # after: LDFLAGS= -L/usr/lib/i386-linux-gnu
After this compilation was done successfully with “make”. This tip is from here.