After installing python 3.6.8 on my linux raspbian distro, when I try to install libunwind8 I get the error:
ModuleNotFoundError: No module named 'apt_pkg' After debugging I found the following SO page bug the answer did not help: import error no module named apt-pkg
The answer given said to install python-apt, which I did, only to get the following error:
Traceback (most recent call last): File "/usr/bin/apt-listchanges", line 29, in <module> import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' (Reading database ... 41347 files and directories currently installed.) Preparing to unpack .../gnupg-agent_2.1.18-8~deb9u4_armhf.deb ... Unpacking gnupg-agent (2.1.18-8~deb9u4) over (2.1.18-8~deb9u3) ... Setting up gnupg-agent (2.1.18-8~deb9u4) ... (Reading database ... 41347 files and directories currently installed.) Preparing to unpack .../gnupg_2.1.18-8~deb9u4_armhf.deb ... Unpacking gnupg (2.1.18-8~deb9u4) over (2.1.18-8~deb9u3) ... Setting up gnupg (2.1.18-8~deb9u4) ... Selecting previously unselected package dirmngr. (Reading database ... 41347 files and directories currently installed.) Preparing to unpack .../dirmngr_2.1.18-8~deb9u4_armhf.deb ... Unpacking dirmngr (2.1.18-8~deb9u4) ... Selecting previously unselected package python-apt. Preparing to unpack .../python-apt_1.1.0~beta5_armhf.deb ... Unpacking python-apt (1.1.0~beta5) ... Processing triggers for install-info (6.3.0.dfsg.1-1+b1) ... Processing triggers for man-db (2.7.6.1-2) ... Setting up dirmngr (2.1.18-8~deb9u4) ... Setting up python-apt (1.1.0~beta5) ... Traceback (most recent call last): File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr, \ File "/usr/share/python/debpython/version.py", line 24, in <module> from ConfigParser import SafeConfigParser ModuleNotFoundError: No module named 'ConfigParser' dpkg: error processing package python-apt (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: python-apt Any clues what's going wrong here and how to fix it?
1 Answer
Which Python version were you using before? I also faced issues after upgrading to python 3.7, I could not start the terminal or execute any application written in python, I had to run sudo update-alternatives --config python3 command then choose the previous python alternative, after this everything went back to normal I can install.
