Я хочу использовать библиотеку 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

1 ответ1

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 также должна быть доступна оттуда, если вы еще не получили его.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .