I just upgraded python in ubuntu to python 3.10 to use the match/case statements, but now, my terminal won't open. Anywhere. I tired opening it on Visual Studio Code, but it says the path does not exist. Gnome terminal and terminator won't even give any feedback. I am using Ubuntu 20.04 with i3wm, my shell is zsh, and here are the commands i used (i modified them from this site and this site):
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.10
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 10
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python2.6 10
sudo update-alternatives --config python
sudo update-alternatives --config python3
For what I remember my previous python version was somewhere around 3.7.
If you prefer, here are the specs from above:
Important: Please remember I do not have access to a terminal. I have still not tried recovery mode, but if you have a non-termianl based solution, it is preferred.
None of the above Solutions worked for me. However after searching a lot for an hour,
(Replace the Python version which was earlier present on your system, instead of 3.8)
sudo apt reinstall python3 python3-minimal python3.8 python3.8-minimal
this command did the magic!
(PS - Make sure you haven't changed anything in the usr/bin/gnome-terminal file)
First line should be
#!/usr/bin/python3
Lesson Learnt - Dont upgrade your OS Python Version manually EVER!
Just found a way to undo it. If you encounter the same problem, here is what I did:
Ctrl+Alt+Fn and a few F buttons (F1, F2, F3...) until I got to a tty menu.
I logged in as myself (not root), and ran sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 to make the default python 2.8 with sudo update-alternatives --config python3 again. Then it worked properly.
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