【Ubuntu issues】ModuleNotFoundError: No module named ‘apt_pkg‘

Traceback (most recent call last):                
  File "/usr/lib/cnf-update-db", line 8, in
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

This error is often caused by a mismatch between the Python version used by the system and the one required by the apt_pkg module.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --config python3

你可能感兴趣的:(linux问题,ubuntu,linux)