Update a raspberry pi to python 3.9

Been attempting to update a 2 year old, untouched raspberry pi to be able to run a pip module that only runs on 3.6+. I updated the operating system and I’ve been attempting to update python following this guide but I get to the last stage and it returns python 3.5.3. (note: i added the line to the bottom of the file because i couldn’t find it)

I also tried sudo update-alternatives --config python but it returned update-alternatives: error: no alternatives for python


First of all, try removing your current python version:

To know your version:

python --version

Then do this to remove Python:

sudo add-apt-repository --remove ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get remove --purge pythonX.X

And finally, enable your repositories again, and install Python 3.9:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9