Проблемы при установке libvirt-python на MacOS

0

Я хочу использовать библиотеку libvirt для установки виртуальной машины на KVM. При установке библиотеки libvirt на Mac я столкнулся с проблемой. Я пытался установить зависимости libvirt, но безрезультатно. Можете ли вы помочь мне с этим.

(venv) Siddharaths-MacBook-Pro-2:Homework1 siddharathgupta$ pip install libvirt-python
Collecting libvirt-python
  Using cached https://files.pythonhosted.org/packages/73/37/52c7076b1b44efe4157d0744be7be01df0c0942f44daba458a77a19f9f8d/libvirt-python-4.10.0.tar.gz
Building wheels for collected packages: libvirt-python
  Running setup.py bdist_wheel for libvirt-python ... error
  Complete output from command /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/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 /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-wheel-WnOPln --python-tag cp27:
  running bdist_wheel
  running build
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 366, in <module>
      "Programming Language :: Python :: 3",
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 147, in run
      check_minimum_libvirt_version()
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 40, in check_minimum_libvirt_version
      spawn([get_pkgcfg(),
    File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 36, in get_pkgcfg
      raise Exception("pkg-config binary is required to compile libvirt-python")
  Exception: pkg-config binary is required to compile libvirt-python

  ----------------------------------------
  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 /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/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 /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-record-4drvGZ/install-record.txt --single-version-externally-managed --compile --install-headers /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/include/site/python2.7/libvirt-python:
    running install
    running build
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 366, in <module>
        "Programming Language :: Python :: 3",
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run
        self.run_command('build')
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 147, in run
        check_minimum_libvirt_version()
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 40, in check_minimum_libvirt_version
        spawn([get_pkgcfg(),
      File "/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/setup.py", line 36, in get_pkgcfg
        raise Exception("pkg-config binary is required to compile libvirt-python")
    Exception: pkg-config binary is required to compile libvirt-python

    ----------------------------------------
Command "/Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/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 /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-record-4drvGZ/install-record.txt --single-version-externally-managed --compile --install-headers /Users/siddharathgupta/PycharmProjects/CSCI561/Homework1/venv/include/site/python2.7/libvirt-python" failed with error code 1 in /private/var/folders/qh/gdlxnjkx39g723d68_l5dzhc0000gn/T/pip-install-SwC4Jj/libvirt-python/
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Я использую Python 2.7.10

Alan Cooper
источник

Ответы:

0

Сообщение об ошибке исключения показывает проблему

Exception: pkg-config binary is required to compile libvirt-python

libvirt-python Модуль - это привязка к API библиотеки libvirt C. Для того, чтобы скомпилировать код C, связанный с libvirt-python, ему нужно найти библиотеку libvirt и включить файлы. Для этого он использует pkg-config инструмент, который является широко используемым стандартом для поиска библиотек. Вы, кажется, не имеете pkg-config установлен на вашем хосте, так что вам нужно установить это. Вы, вероятно, можете получить его для OS-X от homebrew - сама библиотека libvirt также должна быть доступна там, если вы ее еще не получили.

DanielB
источник
Это уже там. Я установил его с помощью доморощенного
Alan Cooper
Что там уже есть? libvirt или pkg-config, или оба? Предполагая, что оба они уже установлены из homebrew, возможно, ваш $ PATH не содержит каталог, в котором homebrew установил двоичный файл pkg-config.
DanielB
pkg-config уже есть. Я проверю $ PATH и добавлю необходимый каталог, если это необходимо. Спасибо за вашу помощь.
Alan Cooper