Belphegor Belphegor - 4 months ago 68
Linux Question

python-dev installation error: ImportError: No module named apt_pkg

I am Debian user, and I want to install python-dev, but when I run the code in the shell as a root:

# aptitude install python-dev


I get the following error:

Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 28, in <module>
import apt_pkg
ImportError: No module named apt_pkg


What seems to be the problem and how can I resolve it?

Answer Source

Make sure you have a working python-apt package. You could try and remove and install that package again to fix the problem with apt_pkg.so not being located.

apt-get install python-apt