0

I am using SL6 and it has python2.6 installed. I successfully installed python2.7

The problem I face right now is when I use command "python" system runs python2.7 whereas when I run "sudo python" the system runs python2.6

Any suggestions on how to make them both use python2.7 ?

I tried "yum remove python" which fails because yum is dependent on python.

Daniel Reis
  • 12,944
  • 6
  • 43
  • 71
adikshit
  • 205
  • 3
  • 10
  • The problem is that for your user (better for your user's _active_ session) the ${PATH} nev var has been updated: _Python27_ path was inserted before _Python26_one, while for user _root_ it hasn't. What would happen if you close the console that you installed _python27_ from? – CristiFati Jul 28 '15 at 23:19

2 Answers2

1

This sounds like a matter of sudo using a secure_path . To walk around this you can try and do this in your ~/.bashrc file

alias sudo='sudo env PATH=$PATH'
user3660570
  • 337
  • 1
  • 14
0

To do what you are asking, you would need to change your root's path and python environment to default to 2.7 instead of the system default 2.6. It is not recommended, because it could break your host. Some system utilities are written in python now instead of C.

Padraic is correct. You can usually explicitly call "python2.7" or "python3". Use "which python2.7" or "which python3" to see if it works for you. Python 3 is probably not installed by default, but it works like this after it has been installed.

See this excellent answer here for more discussion about why not to change root's python environment: Two versions of python on linux. how to make 2.7 the default.

Community
  • 1
  • 1
jdelaporte
  • 127
  • 1
  • 9