I'm using Ubuntu 22.04.4 LTS. When I try to install or update any package getting the below error
$ node --version
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'
I tried to update and reisntall python-apt
library by runnign the below command. But the issues is still presist.
sudo apt update
sudo apt install --reinstall python-apt
The issues got resovled by unistalling and reinstalling the python3-apt
library.
Remove the library:
sudo apt remove python3-apt
Install again:
sudo apt install python3-apt