I recently updated my python release from 3.8 to 3.10, using
sudo update-alternatives --config python3, but this seems to have caused a problem with apt somewhere. Whenever I try to run sudo apt-get update it works as expected. When I then try to run sudo apt-get upgrade, I run into the following problem.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up python-apt (2.0.0ubuntu0.20.04.6) ...
/var/lib/dpkg/info/python-apt.postinst: 6: pycompile: not found
dpkg: error processing package python-apt (--configure):
installed python-apt package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
python-apt
E: Sub-process /usr/bin/dpkg returned an error code (1)
When I try to reinstall python apt to fix this problem with sudo apt install --reinstall python-apt, I get the following error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python-apt:amd64
Does anyone know how I can fix this? I am also unable to open the software updater.
python3.10or use an alias that is notpython. The reason it saysno alternatives for python3is that deadsnakes is not installed as an alternative version to the one you installed in apt. It is a separate package. Don't change the symlink for the stable python3 install that is maintained by apt. – iyrin Apr 16 '22 at 05:01