I tried to update packages in Mint using this command:
sudo apt update
But at the end of the process, the terminal gave me the following traceback:
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' Reading package lists... Done E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi' E: Sub-process returned an error code
I tried to find the solution to fix this, but didn't. Do you have a solution?
If the apt-get also doesn't work, can you try this? Most probably, apt_pkg is not in the correct path.
cd /usr/lib/python3/dist-packages
ls -la /usr/lib/python3/dist-packages
Look for any file of the format apt_pkg.cpython-
and so on. Copy that file's name. And replace apt_pkg.cpython-36m-x86_64-linux-gnu.so
with the copied file's name in the command below, and hit enter.
sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so