Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was using Python 2.7 Happily but today I had to Install Python 2.5 for a different project and while trying to use virtualenv I Installed Python 2.5. Now the Python path Globally is set to Python 2.5. How can I change it back to Python 2.7.

I am on Ubuntu 12.04.

share|improve this question

migrated from stackoverflow.com Jun 26 '13 at 12:25

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 2 down vote accepted

Since on ubuntu 12.04 python 2.5 isn't in the official package sources anymore I'll assume that you downloaded and compiled python yourself.

That means that it probably has been installed to /usr/local, with the binary in /usr/local/bin (if you didn't specify any other installation path).

In the PATH /usr/local/bin usually comes before /usr/bin, where your system's python (2.7) should be found by default, so therefore this is hidden by the older version.

If you want to keep python 2.5, you should probably rename the binary from /usr/local/bin/python to /usr/local/bin/python2.5 (or similar), so that you can still call it by that name, but it won't shadow your system python's binary anymore.

share|improve this answer
    
I might sound noob to you but what do you mean by rename the binary ? –  Leonidus Jun 26 '13 at 10:50
    
the binary is the executable that gets called when you type pyton. the command which python shows you exactly where it is installed. if it's /usr/local/bin/python, then what i've written above should apply. otherwise, how and where did you install python2.5? –  mata Jun 26 '13 at 10:52
    
I have Python 2.5, 2.6, 2.7 all at /usr/local/lib/ and one Python2.7 in /usr/bin –  Leonidus Jun 26 '13 at 11:01
    
everything else you guessed is true. –  Leonidus Jun 26 '13 at 11:01
    
Only two lines did it. rm /usr/local/bin/python and ln -s /usr/local/bin/python2.7/usr/local/bin/python –  Leonidus Jun 26 '13 at 11:18
add comment

Your Answer

 
discard

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