I'm on OSX Lion and I have libxml2 installed (by default) and I have python installed (by default) but they don't talk to one another. What's the simplest way to make this work on Lion?
$ python -c "import libxml2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named libxml2
OS X comes with libxml2 installed, but it's in /usr/include/libxml2 . So that needs to be added to the include path with a -I/usr/include/libxml2 . The headers contain the definitions of the various functions, but the real code lies in shared libraries.
The libxml2-python package contains a module that permits applications written in the Python programming language to use the interface supplied by the libxml2 library to manipulate XML files. This library allows to manipulate XML files. It includes support to read, modify and write XML and HTML files.
libxml2 is installed by default on MacOSX, but not on Windows systems.
sudo python setup.py install
ls /Library/Python/2.7/site-packages/
and you should see a bunch of libxml2 filesYou'll need XCode installed, but like, you should already have that installed, right?
tkone's answer is OK. But brew also can do it.
Try this,
$ brew install libxml2 --with-python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With