Table des matières

ModuleNotFoundError: No module named 'apt_pkg'

Erreur lié a apt et python

Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
  from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
  from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
  import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

une recherche sur apt_pkg.so ne renvoi rien

sudo apt-file search apt_pkg.so

Correction par ajout d'un lien

cd /usr/lib/python3/dist-packages
ls -l apt_pkg.cpython*
sudo ln -s apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so
sudo apt-get update