Question

I referred to this article, but used more recent libraries. To be explicit, I downloaded libgpg-error-1.10, libgcrypt-1.5.0,gnutls-3.1.3 and libvirt-1.0.0

libgpg-error-1.10, libgcrypt-1.5.0 installed OK and when configure gnutls-3.1.3, an error comes:

configure: error:

* Libnettle 2.5 was not found. Note that you must compile nettle with gmp support.

What I want is to use libvirt's python binding(i.e. import libvirt in python). Could anyone explain how to get a useable python libvirt library?

Was it helpful?

Solution

Your easiest options is probably using homebrew to install libvirt:

$ brew install libvirt

After that compiling the Python bindings for libvirt should be trivial.

OTHER TIPS

After you install libvirt with:

$ brew install libvirt

you can install the libvirt python bindings with pip:

$ pip install libvirt-python

I ran the following commands on a fairly fresh MacOSX 10.10.5

bash-3.2$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
bash-3.2$ brew install libvirt
bash-3.2$ brew install libvirt-python
bash-3.2$ pip install libvirt-python
bash-3.2$ echo Instructions at http://stackoverflow.com/questions/13136884/how-to-build-and-install-libvirt-on-mac do not work.

bash-3.2$ sudo easy_install pip
bash-3.2$ pip install libvirt-python
bash-3.2$ echo typical python stuff up - when the install of a tool gets in your way - toss the tool
bash-3.2$ echo unless the tool has worked many many times before.
bash-3.2$ pip install pkg-config
bash-3.2$ brew install pkg-config
bash-3.2$ pip install libvirt-python
bash-3.2$ sudo pip install libvirt-python
bash-3.2$ 

Andrews solution works with one modification for El Capitan and up. As theses versions do not allow write access to /usr/share you need to provide pkg-config with the path of the libvirt api, something like:

export PKG_CONFIG_PATH=/usr/local/Cellar/libvirt/4.3.0/lib/pkgconfig
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top