首页 > 解决方案 > 在 Linux 上安装 ovirt-engine-sdk-python 失败并出现致命错误:libxml/xmlreader.h: No such file or directory

问题描述

无论是在 Linux 操作系统上通过 pip 还是 pip3 运行,以下命令都会给出相同的输出。

pip install ovirt-engine-sdk-python --proxy http://148.87.19.20:80
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Collecting ovirt-engine-sdk-python
  Using cached https://files.pythonhosted.org/packages/28/eb/6ccef9afd320f7e0657af3b03e2c4a18bb12ad3e00c655d6794f46e42c9f/ovirt-engine-sdk-python-4.3.3.tar.gz
Requirement already satisfied: pycurl>=7.19.0 in /usr/lib64/python2.7/site-packages (from ovirt-engine-sdk-python) (7.19.0)
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from ovirt-engine-sdk-python) (1.9.0)
Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from ovirt-engine-sdk-python) (1.1.6)
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: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xoMZFA/ovirt-engine-sdk-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xoMZFA/ovirt-engine-sdk-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-record-4jJ_aR/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-xoMZFA/ovirt-engine-sdk-python/
    Complete output (29 lines):
    4.3.3
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/reader.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/readers.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/writers.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/http.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/__init__.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/types.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/service.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/version.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/writer.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    copying lib/ovirtsdk4/services.py -> build/lib.linux-x86_64-2.7/ovirtsdk4
    running build_ext
    building 'ovirtsdk4.xml' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/ext
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/usr/include/python2.7 -c ext/xml.c -o build/temp.linux-x86_64-2.7/ext/xml.o
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/usr/include/python2.7 -c ext/ov_xml_module.c -o build/temp.linux-x86_64-2.7/ext/ov_xml_module.o
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/usr/include/python2.7 -c ext/ov_xml_reader.c -o build/temp.linux-x86_64-2.7/ext/ov_xml_reader.o
    ext/ov_xml_reader.c:20:30: fatal error: libxml/xmlreader.h: No such file or directory
     #include <libxml/xmlreader.h>
                                  ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xoMZFA/ovirt-engine-sdk-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xoMZFA/ovirt-engine-sdk-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-record-4jJ_aR/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

我们正在尝试在这个系统上设置 python sdk,所以这阻止了我们的进展。

标签: python-3.xoracleovirt

解决方案


Ubuntu版本:sudo apt install libxml2-dev


推荐阅读