Method 1: Install the python-apt package
This is the most straightforward fix — the apt_pkg module is part of the python-apt package.
Method 2: Reinstall python3-apt
This reinstalls the package to ensure all files are correctly placed.
Method 3: Copy the .so file to the correct location
This method involves copying the shared object file to the correct location.
Adjust the filename to match your Python version and architecture (e.g.,
cpython-311 for Python 3.11).