Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named libxml2

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).

like image 790
Malintha Avatar asked Aug 11 '14 09:08

Malintha


2 Answers

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

sudo apt-get install python-libxml2
like image 89
enrico.bacis Avatar answered Oct 21 '22 23:10

enrico.bacis


You'd have to install python-libxml2.

Note that that's a fairly basic wrapper around the libxml2 C library. You may want to use lxml instead, for a far more Pythonic XML API.

like image 1
Martijn Pieters Avatar answered Oct 22 '22 00:10

Martijn Pieters