Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the "python" command to point to python2 instead of python3?

Tags:

python

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
like image 951
Shivang Patel Avatar asked Mar 02 '23 07:03

Shivang Patel


1 Answers

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 
like image 94
L. Quastana Avatar answered Mar 04 '23 21:03

L. Quastana