I tried to install python3.12 from here. Then I wanted to switch the default python3 (3.10) to the newly installed and delete the old (3.10) one but it turns out, I can't get rid of the old version easily as I thought. No matter what I do, it takes all the system files with it. I once messed up my Ubuntu 16.04 like this and I don't wanna do that again.
Moving on, after I changed the python3 to run python3.12 using update-alternatives
command, the apt stopped working and a lot of errors occurred.
This error occurred in addition to the below error when I changed the python3 version:
Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 29, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
This error occur whenever I run apt:
Setting up libpython3.12-testsuite (3.12.1-1+jammy1) ...
File "/usr/lib/python3.12/test/test_future_stmt/badsyntax_future10.py", line 3
from __future__ import print_function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: from __future__ imports must occur at the beginning of the file
dpkg: error processing package libpython3.12-testsuite (--configure):
installed libpython3.12-testsuite package post-installation script subprocess r
eturned error exit status 1
Setting up idle-python3.12 (3.12.1-1+jammy1) ...
Setting up python3.12-venv (3.12.1-1+jammy1) ...
dpkg: dependency problems prevent configuration of python3.12-full:
python3.12-full depends on libpython3.12-testsuite; however:
Package libpython3.12-testsuite is not configured yet.
dpkg: error processing package python3.12-full (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup erro
r from a previous failure.
Setting up python3.12-gdbm:amd64 (3.12.1-1+jammy1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
libpython3.12-testsuite
python3.12-full
E: Sub-process /usr/bin/dpkg returned an error code (1)
When I restarted it, the terminal won't open at all. I had to use Ctrl+Alt+F3 to get a tty and change the python3 version.
Now, I've completely removed python3.12 and I'm waiting for a response.