1

Some time ago I used

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10

to simply write python for having python3.

I noticed this alias breaks the package manager in some cases, so Im trying to revert this. I used

sudo update-alternatives --remove-all python

to remove this. But now I want to go back to default, meaning writing python calls python2 and only python3 calls python3.

Any idea how we can do this?

Cheers

EDIT:

By running

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 10

I managed to link python2 to python and leaving python3 as it. is. Is this the proper way of fixing it? It doesn't seem like it...

EDIT2:

I just upgraded my system from 19.10. to 20.04., I have no problems anymore regarding broken packages, but this was probably the easy-way-out, I'd still appreciate a reasonable thought about how to resolve these python links well.

Funny though, I thought python2 is not used anymore in 20.04., but if I type python then python2 is called again.. how?

1
  • 1
    Just FYI, avoid using python2 if possible, since it is no longer maintained. Commented Jun 16, 2020 at 11:11

1 Answer 1

1

There is a good answer to this question on one of the sister sites, which essentially says to create an alias in a bash file (e.g., .bashrc).

The reason python is still installed in the OS is likely because people & programs still use it, though as Adam mentions it isn't maintained. Corroboration that it comes packaged in Ubuntu 20.04 and the program to change this without just changing a bash file (python-is-python3) is in this answer.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Daniel Connelly for your answer, which give me more insight. Cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.