Fix
To work around this issue, copy theapt_pkg shared object file from the existing Python installation to a more generic name that APT can recognize:
Check your actual Python version by running
python3 --version and adjust the filename accordingly (e.g., cpython-311 for Python 3.11).