python - pip install libvirt-python 在 vi​​rtualenv 中失败

标签 python python-3.x pip

我目前正在尝试将 libvirt-python 安装到 virtualenv。

当我运行它时,我得到这个输出

$ pip install libvirt-python
Collecting libvirt-python
  Using cached libvirt-python-3.5.0.tar.gz
Building wheels for collected packages: libvirt-python
  Running setup.py bdist_wheel for libvirt-python ... error
  Complete output from command /home/john/virtenvs/hw/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_fz8vok/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 /tmp/tmpg1j1nq_wpip-wheel- --python-tag cp35:
  Package libvirt was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libvirt.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libvirt' found
  Package libvirt was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libvirt.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libvirt' found
  running bdist_wheel
  running build
  /usr/bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt
  Package libvirt was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libvirt.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libvirt' found
  error: command '/usr/bin/pkg-config' 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 /home/john/virtenvs/hw/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_fz8vok/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 /tmp/pip-leu8ei67-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/john/virtenvs/hw/include/site/python3.5/libvirt-python:
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    running install
    running build
    /usr/bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    error: command '/usr/bin/pkg-config' failed with exit status 1

    ----------------------------------------
Command "/home/john/virtenvs/hw/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-3_fz8vok/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 /tmp/pip-leu8ei67-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/john/virtenvs/hw/include/site/python3.5/libvirt-python" failed with error code 1 in /tmp/pip-build-3_fz8vok/libvirt-python/

没有 virtualenv,我可以将 libvirt 导入到我的 python shell 中。

最佳答案

libvirt-python 的 pip 安装要求您的系统上存在文件 libvirt.pc,因为安装脚本使用 pkg-config 来检查软件包详细信息libvirt 的。

对于 Debian,我发现这个文件是由包 `libvirt-dev' 提供的。所以你可以尝试一下

apt-get install libvirt-dev

或您的发行版的等效内容。

关于python - pip install libvirt-python 在 vi​​rtualenv 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45473463/

相关文章:

Python:如何使用 psycopg2 将字符串传递给 postgres 命令

python-3.x - Matplotlib WSL2 Pycharm

python - 缺少可选依赖项 'tables' 。在 Pandas to_hdf

python - sys.exit(0) 和 os._exit(0) 有什么区别

python - BeautifulSoup:find_all() 和 unicode 的问题?

python - PIL Image.open 创建损坏的图像

python - 如何为空集提供类型注释?

python - 如何从 Dockerfile 安装 Python 3.7 和 Pip

ubuntu - 为什么 pip3 软件包没有安装在特定网络上?

python - odoo 12. 我无法对 Many2one 字段进行动态过滤