I'm just started using ubuntu and tried to upgrade python from 3.8.10 -> 3.10.4 in my venv with the following commands:
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.10
it is installed successfully but when I check the version with:
python3 --version
it still show:
python 3.8.10
and my code can only work with python version > 3.10. How can I fix this?
I'm also using the deadsnakes PPA. Every version is installed separately, so you can switch versions on the fly. So to use any version installed from deadsnakes, you have to call it explicitely.
$ python3.10 --version
Python 3.10.4
You have to use update-alternatives, following such approach https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
You'll be able to choose more conveniently which python version you want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With