0

When I type python into my Ubuntu 18.04 terminal, python3 starts. The thing is I haven't set an alias for python, e.g. see here. Could anyone explain to me how is this possible and what I would need to change if I want to reverse it?

cgss
  • 121

1 Answers1

1

Open the terminal and type:

sudo apt install python-is-python2

This is a convenience package which ships a symlink to point /usr/bin/python interpreter at the current default python2.

karel
  • 114,770
  • So this has nothing to do with how it changed in the first place, but is a quick fix, right? – cgss Oct 05 '20 at 08:00
  • This is a quick fix that doesn't have anything to do with how it changed in the first place. – karel Oct 05 '20 at 08:01
  • Understood. Thank you for this. I will upvote you but I will not accept your answer(at least for now) because it answers half of the question. I hope you understand. – cgss Oct 05 '20 at 08:03
  • 1
    The first thing that I would do to research what caused the python command to start python3 is to look at all your software sources in /etc/apt/ directory and check if there is any PPA or other non-default software source that contains packages that could have caused this issue if they were installed. btw There is another package in the default Ubuntu repositories named python-is-python3 which which ships a symlink to point /usr/bin/python interpreter at the current default python3. – karel Oct 05 '20 at 08:10
  • How do you suggest doing so? – cgss Oct 05 '20 at 08:40
  • If you have Synaptic installed (sudo apt install synaptic) open Synaptic, click the Origin button in the left pane, and then you can select any software source and it will show all the packages that you installed from that software source. – karel Oct 05 '20 at 08:42