ImportError: No module named libxml2

Malintha picture Malintha · Aug 11, 2014 · Viewed 13k times · Source

I am using Ubuntu 12.04.2 LTS. I have used libxml2 in my python script and when I try to run it, gives error

Traceback (most recent call last):
File "deploy.py", line 3, in <module>
import libxml2
ImportError: No module named libxml2

I tried almost all stackoverflow answers for the same question but nothings solves the issue (Installed several different packages).

Answer

enrico.bacis picture enrico.bacis · Aug 11, 2014

You have to install the package in Ubuntu before being able to use it:

sudo apt-get install python-libxml2