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 had python 2.6 in my server to begin with. Then I downloaded python 2.7 and installed using make and make altinstall. When I try just python in the terminal it opens up python 2.7 but sudo python opens up 2.68. all the commands like virtualenv pip use python 2.68

share|improve this question

migrated from stackoverflow.com May 27 '13 at 10:05

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

    
Probably because $PATH differs between you and root. –  Aya May 26 '13 at 16:02

2 Answers 2

up vote 5 down vote accepted

Because sudo XYZ basically means "run XYZ as some other user (root by default)". That user may have a different set of environment variables, including $PATH.

To confirm this, compare the output of the following:

env | grep PATH
sudo env | grep PATH
share|improve this answer
    
Thanks. That seems to be the case. How do I ensure the path are same? –  user1743992 May 26 '13 at 16:53

Check the outputs of which python and sudo which python, they should be different. If so, check your $PATH for root and your normal user as noted by others.

share|improve this answer

Your Answer

 
discard

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