libvirt-python 安装 mac 错误

libvirt-python install on mac error

当我尝试通过以下方式安装 libvirt-python 时:

 pip install libvirt-python

我收到以下错误:

Collecting libvirt-python
  Downloading libvirt-python-2.5.0.tar.gz (172kB)
    100% |████████████████████████████████| 174kB 2.4MB/s
Building wheels for collected packages: libvirt-python
  Running setup.py bdist_wheel for libvirt-python ... error
  Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-build-JcUj3e/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/tmp79QS6spip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  /usr/local/bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt
  /usr/local/opt/python/bin/python2.7 generator.py libvirt /usr/local/Cellar/libvirt/3.0.0/share/libvirt/api/libvirt-api.xml
  Found 418 functions in /usr/local/Cellar/libvirt/3.0.0/share/libvirt/api/libvirt-api.xml
  Found 0 functions in libvirt-override-api.xml
  Generated 344 wrapper functions
  Missing type converters:
  virConnectSecretEventGenericCallback:1
  virStorageVolInfoPtr:1
  ERROR: failed virConnectSecretEventRegisterAny
  ERROR: failed virStorageVolGetInfoFlags
  error: command '/usr/local/opt/python/bin/python2.7' failed with exit status 1

  ----------------------------------------
  Failed building wheel for libvirt-python
  Running setup.py clean for libvirt-python
Failed to build libvirt-python
Installing collected packages: libvirt-python
  Running setup.py install for libvirt-python ... error
    Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-build-JcUj3e/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-eNRl_m-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    /usr/local/bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt
    /usr/local/opt/python/bin/python2.7 generator.py libvirt /usr/local/Cellar/libvirt/3.0.0/share/libvirt/api/libvirt-api.xml
    Found 418 functions in /usr/local/Cellar/libvirt/3.0.0/share/libvirt/api/libvirt-api.xml
    Found 0 functions in libvirt-override-api.xml
    Generated 344 wrapper functions
    Missing type converters:
    virConnectSecretEventGenericCallback:1
    virStorageVolInfoPtr:1
    ERROR: failed virConnectSecretEventRegisterAny
    ERROR: failed virStorageVolGetInfoFlags
    error: command '/usr/local/opt/python/bin/python2.7' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-build-JcUj3e/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-eNRl_m-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/h4/8vv21pzx2k9471lzymg_r3th0000gp/T/pip-build-JcUj3e/libvirt-python/

任何帮助将不胜感激,因为我不知道如何解决这个问题。

Mac 10.11.4 Python 2.7.13 & 2.7.10 通过 brew 安装的 libvirt

Warning: libvirt-3.0.0 already installed

您需要安装 libvirt-python 3.0.0,但 PyPI 上的仍然是 2.5.0。 运行 此命令改为:

pip install https://libvirt.org/sources/python/libvirt-python-3.0.0.tar.gz

参考:

我们忘记将 3.0.0 版本上传到 PyPI。此错误现已解决,因此如果您重试,它应该会正确构建。