Ubuntu 11.04 ships with Python 2.7.x by default. You don’t want to replace that system installed version of Python since many things are dependent on it and Python 3.2 is not backwards compatible with Python 2.x. So the alternative is to just install Python 3.2 alongside Python 2.7.x. Today I’ll walk through how I went about doing that.
[ad name=”Google Adsense”]
With Ubuntu 11.04 up and running open the Terminal and enter the following commands (make sure you are in a folder where you want the Python files downloaded to):
$ sudo apt-get install build-essential $ sudo apt-get install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev $ wget http://python.org/ftp/python/3.2/Python-3.2.tgz $ tar -xvf Python-3.2.tgz && cd Python-3.2/ $ ./configure $ make $ sudo make altinstall
Note: Make sure to do the altinstall since you don’t want to mess up the system installed Python.
Still in the Terminal type this to verify we still have the system installed version of Python:
$ python
Note: To get out of the Python interpreter just type quit()
Now type this:
$ python3.2
Now to use Python 2.7.x and Python 3.2 from a script simply create a new file named python-version.py with the contents like this:
import sys print(sys.version_info[:])
Run that code against both versions of Python.





Pingback: Install CherryPy 3.2 on Ubuntu 11.04 and run it with Python 3.2 | Giant Flying Saucer
Wonderful tutorial!Helped me a lot!
I just want to take a doubt:It comes with IDLE?
Pingback: Install Python 3.2 on Ubuntu 11.04 « Python Adventures
Thanks so much. This tutorial is just what I needed to get python 3.2.2 up and running.
Thanks Again,
Kim