Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm very new in Ubuntu,also in Linux. I've just installed Ubuntu 11.04 which comes with python 2.7 by default. But I want to install python 2.6, how am I about to do that? Thanks.

share|improve this question
add comment

3 Answers

You can install python 2.6 by running this command clicking this link: python2.6

Or by typing this command in a terminal.

sudo apt-get install python2.6
share|improve this answer
add comment

Get pythonbrew. This should let you run 2.6 and 2.7 side by side.

pythonbrew install 2.6
pythonbrew switch 2.6
share|improve this answer
1  
What are the benefits of using pythonbrew compared to just installing 2.6 from the repositories? Would issuing "pythonbrew switch 2.6" make Ubuntu's own python programs (there are quite a few of them) use Python 2.6 too? If yes, can it make them to fail? –  Sergey Oct 9 '11 at 11:59
add comment

Just to list all the options: just pulling down a source tarball from python.org, unpacking it and compiling your own python interpreter is also easy and is actually what real men do :) You can install it in a separate directory so it doesn't interfere with the system python. Messing with system python is dangerous because lots of Ubuntu programs use it. So something like this:

sudo apt-get install build-essential
wget http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tar.bz2
tar jxf ./Python-2.6.7.tar.bz2
cd ./Python-2.6.7
./configure --prefix=~/mypython && make && make install

would build you your own Python which you'll be able to invoke as

./mypython/bin/python2.6

Supposedly, pythonbrew (mentioned in the other answer) may automate the process a bit, but it's really not that complex

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.