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
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
use python3.7 as default
Simple solution is edit .bashrc and put this line:
alias python3=python3.7
Whenever you will write python3 it will replace it with python3.7.
Or you can use command update-alternatives which is preferred i.e:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
So here python3.7 will have higher priority then python3.6. Then use:
sudo update-alternatives --config python3
Press the enter key if you are satisfied
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us