Python 3.2 installation on Ubuntu 12.04

narlin picture narlin · Jul 31, 2012 · Viewed 28.6k times · Source

I am trying to install python 3.2.3 on my ubuntu machine, which is 12.04, but I do not want to disturb the current 2.7 installation. After searching on the internet, I found a reference here. I followed the instructions, but when trying to run

sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev

I get an error saying that

E: Package 'libreadline5-dev' has no installation candidate.

What am I missing? Is there any other way to install python 3.2 on ubuntu? If I use apt-get, will it disturb the current installation?

Answer

emu picture emu · Jul 31, 2012

You can install as many Python versions as needed. A call to python from the shell will execute python2.7 (you can check that by executing ls -l /usr/bin/python), python 3.2 can be called also as python3.

If you have even more versions, these can be accessed directly with their numbers as python2.6 etc. I personally have versions 2.5, 2.6, 2.7 and 3.2 installed for compatibility reasons.