0

Older versions of Ubuntu shipped with python 2.7 and python 3.6. But in Ubuntu 20.04 LTS, only python 3.8 is installed. So when python was typed in terminal, python3.8 opened. python, python3 and python3.8 did the same work of opening python3.8.

But later on when I installed python2.7, it messed the python command. When I used python command, python2.7 started opening. To use python3.8 now I needed python3 or python3.8.

Can someone explain why did python command changed its target application?

3

The policy of the Ubuntu developers, following PEP394, is that python links ONLY to a Python2 interpreter. Similarly, python3 links ONLY to a Python3 interpreter.

  • You can change python to link to anything you wish...but we won't provide support for it.

  • No packages in the Ubuntu repositories would link python to a Python3 interpreter - any deb package doing so would be an awful bug.

When you install a Python2 interpreter, overwriting your old python link (/usr/bin/python) with a new link is expected behavior.

Do not install manual files or links in locations commonly used by a package manager (like /usr/bin). You can install your own python link in several locations in your $PATH that are safe from overwriting by a package manager. For example, /home and /usr/local/.

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.