How to fix 'ModuleNotFoundError: No module named 'apt_pkg'?

前端 未结 4 1657
眼角桃花
眼角桃花 2021-02-05 10:11

I\'m running code sudo apt update and fetch error

ModuleNotFoundError: No module named \'apt_pkg\'.

Please, help me s

4条回答
  •  粉色の甜心
    2021-02-05 10:34

    In my case the problem was due to upgrading python version from 3.6 to 3.8.

    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
    

    Solved by:

    Settings back the python version to 3.6

提交回复
热议问题