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

前端 未结 4 1656
眼角桃花
眼角桃花 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:40

    In my case, the problem was that I removed original /usr/bin/python3 symlink on Ubuntu 18.04 and replaced it with one pointing to python3.8. Problem disappeared when I restored the original pointing to python3.6

    My takeaway is: if you need custom version of some library or module, install it in an isolated environment, do not mess up with system settings. Otherwise you are at risk of breaking something which can be noticed only later when it's difficult to figure out what exactly is wrong.

提交回复
热议问题