Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在Mac上构建和安装libvirt?_Python_Macos_Installation_Libvirt - Fatal编程技术网

Python 如何在Mac上构建和安装libvirt?

Python 如何在Mac上构建和安装libvirt?,python,macos,installation,libvirt,Python,Macos,Installation,Libvirt,我提到了,但使用了最近的库。明确地说,我下载了 libgpg-error-1.10,libgcrypt-1.5.0,gnutls-3.1.3和libvirt-1.0.0 libgpg-error-1.10,libgcrypt-1.5.0安装正常,配置gnutls-3.1.3时出现错误: 配置:错误: *未找到Libnettle 2.5。请注意,您必须使用gmp支持编译nettle 我想要的是使用libvirt的python绑定(即在python中导入libvirt)。有人能解释一下如何获得一个可

我提到了,但使用了最近的库。明确地说,我下载了
libgpg-error-1.10
libgcrypt-1.5.0
gnutls-3.1.3
libvirt-1.0.0

libgpg-error-1.10
libgcrypt-1.5.0
安装正常,配置
gnutls-3.1.3
时出现错误:

配置:错误:

*未找到Libnettle 2.5。请注意,您必须使用gmp支持编译nettle


我想要的是使用libvirt的python绑定(即在python中导入libvirt)。有人能解释一下如何获得一个可用的python libvirt库吗?

您最简单的选择可能是使用安装
libvirt

$ brew install libvirt

在这之后,为
libvirt
编译Python绑定应该很简单。

在安装libvirt之后:

$brew安装libvirt

您可以使用pip安装libvirt python绑定:


$pip install libvirt python
我在一个相当新的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只需对El Capitan及以上进行一次修改。由于这些版本不允许对
/usr/share
进行写访问,您需要为
pkg config
提供
libvirt api
的路径,例如:

export PKG_CONFIG_PATH=/usr/local/Cellar/libvirt/4.3.0/lib/pkgconfig

libvirt-python绑定是自动编译的,但需要在
/usr/local/ceral/libvirt/0.9.11.6/lib/python2.7/site-packages/
手册的
/libvirt/python2.7/site-packages/
下链接。您指的是哪种解决方案?