I am on Ubuntu 11.04 and have Python 2.6 installed. I would like to upgrade to Python 2.7. How should I go about doing this?

  • 2
    Are you sure you're on 11.04? It ships with Python 2.7 by default. – Stefano Palazzo Jun 5 '11 at 4:41
  • I don't know. I have upgraded from 10.04 to 11.04, where I had python 2.6. Could that be the reason? – Animesh Jun 5 '11 at 4:51
  • You can open a Terminal and type lsb_release -cds to make sure. – Stefano Palazzo Jun 5 '11 at 5:03

If indeed you find you don't have python 2.7 its in the repositories

sudo apt-get install python2.7

You may find, however, that instead of calling python to compile, having multiple versions will need you to specifically call python2.7.

You can overwrite this behavior by redirecting the 'python' link in your /usr/bin/ directory to the python2.7 executable. (This may cause problems if you're keeping legacy programs that are expecting 2.6 and are badly coded, however I very much doubt it.)

  • hi thomas, when i typed python in the command line, it says i have v2.71. That's great, but why does it show v2.6 of IDLE, the Unity menu, when I type idle? Any clues? – Animesh Jun 6 '11 at 17:45
  • i wouldn't be surprised if you had 2.6 installed as well, lots of GUIs are written in python, and demand certain versions. i would expect, therefore, that IDLE should have a setting allowing you to choose the python executable it uses? redirect this to /usr/bin/python and you should be back on 2.7 :) – thomasmichaelwallace Jun 6 '11 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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