how to change python version code example

Example 1: command to upgrade python version

python -m pip install pip
#or
python -m pip install –upgrade pip
python -m pip install --upgrade pip

Example 2: how to change python version on linux

#Check available versions
ls /usr/bin/python*
#Change the used version 3.5 or 3.7 etc
alias python='/usr/bin/python3.x'
#do this other thing
. ~/.bashrc
#Check version 
python --version

Example 3: change default python version

sudo update-alternatives --config python

Example 4: pip change python version

pip upgrade -pip

Tags:

Misc Example