Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add python 3.10 on ubuntu

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?

like image 520
Hoang Le Doan Avatar asked Oct 21 '25 17:10

Hoang Le Doan


2 Answers

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
like image 193
Sören Avatar answered Oct 23 '25 06:10

Sören


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.

like image 41
pierrz Avatar answered Oct 23 '25 06:10

pierrz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!