The ‘python’ program command executes Python2. Python3 should be executed using the python3 command, but python3 can be executed by using the command ‘python’. You can learn “How can Python 3 be executed using the python command?”
Currently, I am using Kali Linux to set Python3 to be executed using the python command.
You will be able to:
- Set ‘python’ program command execute Python3
- Set cls to clear screen in Linux (Kali Linux, Ubuntu, Fedora, Debian)
- Set pip3 as default pip installer (‘pip’ program command execute pip3)
Applicable Operating Systems: Kali Linux, Ubuntu, Debian, Fedora, etc.
Set python3 as default interpreter in Linux
Let set Python 3 be executed using the python command in Linux. I also have pasted a video for you…
Note: Install gedit by typing (sudo apt install gedit) in terminal
sudo apt install gedit
Steps and Codes to Set python3 as default interpreter in Linux
- Type “sudo gedit ~/.bashrc” in terminal
sudo gedit ~/.bashrc
- A new window will pop up
- Add the following codes at the top of the text-editor(window)
alias python=python3 alias cls=clear alias pip=pip3
Have a look:
#~/.bashrc: executed by bash(1) for non-login shells. see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) #for examples #If not running interactively, don't do anything alias python=python3 alias cls=clear alias pip=pip3 case $- in i) ;; *) return;; esac #don't put duplicate lines or lines starting with space in the history. #See bash(1) for more opti...
- Click on “SAVE”
- Done… Close all and open a new terminal (CTRT+ALT+T)
- Type ‘python’ to test.
Do you want to make money coding Python? If yes, click me to make money coding Python…
The result after setting python3 as default interpreter in Linux
codie@kali:~$ python Python 3.8.3 (default, May 14 2020, 11:03:12) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
- Successfully set python3 as default interpreter in Linux…
And also cls can clear the screen of Linux terminal. And you can use pip to install python packages as pip3.
Hope it helped you…
Keep learning Python, because it’s #Beneficial_Python.