linux set default python version code example
Example 1: linux set python 3 as default
1. Check current version:
$ python --version
2. get root permissions:
$ sudo su
3. set python3 as default:
$ update-alternatives --install /usr/bin/python python /usr/bin/python3 1
4. Done. (Check by $ python --version)
Example 2: how to change python version on linux
ls /usr/bin/python*
alias python='/usr/bin/python3.x'
. ~/.bashrc
python --version
Example 3: change default python version
sudo update-alternatives --config python