Cause:
I did the mistake of upgrading my system's (Ubuntu 20.04.6 LTS) python version from 3.10 to 3.12.
Issue:
Since then, my terminal wouldn't open.
And when opening a virtual terminal (CTRL
+ALT
+F3
) it first displays ModuleNotFoundError: No module named 'apt__pkg'
, and then it (the virtual terminal) keeps on working normally.
Attempted solutions
I tried leaving python3.10
as the only python-alternatives
and tried adding other alternatives (python3.8
), but the issue persists.
I added alias python='usr/bin/python3'
to my .bashrc
I commented the export $PATH=...
by anaconda
The only installed version right now is 3.10.6. python -V
as well as python3 -V
give 3.10.6
I did as the comments suggested (reverting to 3.8) since it is the actual default for FocalFossa
Toolchain Upgrades ️
Ubuntu 20.04 LTS comes with [...] Python 3.8.2, [...].
Source: FocalFossa/ReleaseNotes
But the terminal still doesn't work.
Figures:
Recovery mode
Updates
.bashrc
python -V
update-alternatives
Not duplicate of this, because:
/usr/bin/python3
points to/etc/alternatives/python3
which in turn points to/usr/bin/python3.10
, all of which do exist. – Omar Trkzi Nov 22 '23 at 10:44gnome-terminal
to open. Return your python3 defaults to what is expected for your release (ie. 20.04 if that's what you're using) – guiverc Nov 22 '23 at 10:47python3
in shell really, truly runs the Python 3.8 interpreter instead of a different version. – user535733 Nov 22 '23 at 11:17python3.8 | 3.8.10-0ubuntu1~20.04.8 | focal-security | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
which will not impact working function; but you need to revert changes you did in trying to change default. A non-destructive re-install maybe the fastest if you don't know what you did. – guiverc Nov 22 '23 at 21:19