1

When I checked Python version as normal user, it is showing Python 2:

$ python --version
Python 2.7.15rc1

And when try to run as root :

# python --version
Python 3.6.7

Any suggestion how to remove this Python 2.7

  • 2
    If your main goal is to call python3 when you run python, you must define aliases in .bashrc instead of removing python. Messing up python may cause your system to break. – Kulfy Mar 1 at 5:16
6

You need to define the two different python versions

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2

Then you need to choose which version should be defined as default

sudo update-alternatives --set python /usr/bin/python3.6
  • Nice to hear, can you mark it as an answer then? – MatsK Mar 2 at 16:19

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.