Switch between Python versions as non root

前端 未结 3 1222
后悔当初
后悔当初 2021-01-06 12:38

I just installed Python 2.7 in our server, they had 2.4 installed before hand.

After I built the new version, my path is still pointing to the old version of python,

3条回答
  •  醉话见心
    2021-01-06 13:13

    First, you should check your ~/.profile and your shells config files (e.g. ~/.bashrc for bash) for any export $PATH= (or PYTHONPATH, depending on what you're referring to exactly) directives containing the offending path. If there are some, change them and relogin. That should fix your problem.

    If it doesn't, talk to your admin. If that doesn't help either, you can do the following. In your shell, run (may substitute PATH with PYTHONPATH, depending on what you really need):

    echo $PATH
    

    copy the output and modify it according to your needs. Then open another shell and run (remember the substitution):

    export PATH="whatever you copied before"
    

    check that everything is fine (i.e. that you can still call all applications you need and that your path is adapted accordingly). If that's the case, add the command to your ~/.profile.

提交回复
热议问题