Python 3 as default Python command [duplicate]
I am using Visual Studio Code for my Python programming and the problem that I am facing is that on terminal when I type the command python, by default Python 2.7 is loaded. So because of this I am not able to debug my Python 3 commands on my Ubuntu Budgie.
What should I do in order to uninstall Python 2.7 and make 3.7 as my default Python? I have uninstalled Python 2.7 by using the command sudo apt-get remove python. Even after doing this, I have to type python3 to load Python 3.7 and I get an error when just I type python.
How do I make my Python 3 default so that when I type python, Python 3.7 starts?
-Codec Leaper
21 Answer
The simplest is to make an alias in your .bashrc.
To do so open your .bashrc with:
nano ~/.bashrc or
nano ~/.bash_aliasesand add in the section # some more aliases a new line containing
alias python='python3'Open a new terminal and it should work fine.
NOTE: It's not recommended to make a symbolic link in your /usr/bin.
For visual studio code: The settings for python3 has to be set within the program - look at this link how to set the right python path.
3