0

我正在尝试使用以下命令在我的 Windows 10 64 位机器上安装 ovirt python sdk

pip install ovirt-engine-sdk-python

我收到以下错误

Collecting ovirt-engine-sdk-python
  Using cached ovirt-engine-sdk-python-4.4.10.tar.gz (333 kB)
Requirement already satisfied: pycurl>=7.19.0 in c:\python37\lib\site-packages (from ovirt-engine-sdk-python) (7.43.0.5)
Requirement already satisfied: six in c:\python37\lib\site-packages (from ovirt-engine-sdk-python) (1.15.0)
Using legacy 'setup.py install' for ovirt-engine-sdk-python, since package 'wheel' is not installed.
Installing collected packages: ovirt-engine-sdk-python
    Running setup.py install for ovirt-engine-sdk-python ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-5bmup8ae\\ovirt-engine-sdk-python_e4aa3cc952084095b14b9ec184319630\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-5bmup8ae\\ovirt-engine-sdk-python_e4aa3cc952084095b14b9ec184319630\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-2ivjrddy\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\ovirt-engine-sdk-python'
         cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-5bmup8ae\ovirt-engine-sdk-python_e4aa3cc952084095b14b9ec184319630\
    Complete output (28 lines):
    4.4.10
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\http.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\reader.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\readers.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\service.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\services.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\types.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\version.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\writer.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\writers.py -> build\lib.win-amd64-3.7\ovirtsdk4
    copying lib\ovirtsdk4\__init__.py -> build\lib.win-amd64-3.7\ovirtsdk4
    running build_ext
    building 'ovirtsdk4.xml' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\ext
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcext\ov_xml_module.c /Fobuild\temp.win-amd64-3.7\Release\ext\ov_xml_module.obj
    ov_xml_module.c
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcext\ov_xml_reader.c /Fobuild\temp.win-amd64-3.7\Release\ext\ov_xml_reader.obj
    ov_xml_reader.c
    ext\ov_xml_reader.c(20): fatal error C1083: Cannot open include file: 'libxml/xmlreader.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-5bmup8ae\\ovirt-engine-sdk-python_e4aa3cc952084095b14b9ec184319630\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-5bmup8ae\\ovirt-engine-sdk-python_e4aa3cc952084095b14b9ec184319630\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-2ivjrddy\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\ovirt-engine-sdk-python' Check the logs for full command output.

我已经使用 MS Visual Studio 安装了最新的 c++ buildtools,我也已经下载了最新的 libxml 包但仍然无法安装 ovirt 包。

pip install lxml
Requirement already satisfied: lxml in c:\python37\lib\site-packages (4.6.3)

有什么我在这里想念的吗?

4

1 回答 1

0

来自README.adoc

SDK 使用libxml2来解析和呈现 XML。与该库交互的 SDK 部分是用 C 编写的。这意味着在构建之前,您必须确保在系统中安装了 C 编译器以及所需的头文件和库文件。例如,如果您使用 Fedora 或 CentOS 等发行版:

dnf -y 安装 gcc libxml2-devel python3-devel

如果您使用的是 Debian 或 Ubuntu 等发行版:

apt-get --assume-yes 安装 gcc libxml2-dev python3-dev

对于 w32,请尝试以下方法之一:http: //xmlsoft.org/sources/win32/(可在http://xmlsoft.org/downloads.html中找到)。

于 2021-03-23T09:29:15.410 回答