Due to my own stupidity, I somehow set the python command to run python 3 instead of the default python 2. How do I undo this? I am on Ubuntu 18.04.
$ python -V
Python 3.7.6
$ python3 -V
Python 3.7.6
Due to my own stupidity, I somehow set the python command to run python 3 instead of the default python 2. How do I undo this? I am on Ubuntu 18.04.
$ python -V
Python 3.7.6
$ python3 -V
Python 3.7.6
You can change the alias python="/usr/bin/python2.7",for example :
alias python="/usr/bin/python3.3"
python
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 16 2013, 23:39:35)
You can also add this line in your .bashrc file
echo "alias python=/usr/bin/python3.3" >> ~/.bashrc
~/.bashrc file or run this command in the bash: echo "alias python=/usr/bin/python3.3" >> ~/.bashrcYou can list all the version of Python installed and change the default Python version Try the following commands on terminal.
$:~# update-alternatives --config python
There are 4 choices for the alternative python (providing /usr/local/bin/python).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python3 4 auto mode
1 /usr/bin/python2.7 2 manual mode
* 2 /usr/bin/python3 4 manual mode
3 /usr/bin/python3.7 3 manual mode
4 /usr/bin/python3.8 4 manual mode
Press <enter> to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/bin/python3.8 to provide /usr/local/bin/python (python) in manual mode
Set the default python version using python version. Finally, you can check the success of command as below.
root@kali:~# python --version
Python 3.8.2
It should show Python 2.x in your case.