lxml安装在红帽子上

时间:2015-09-15 02:16:08

标签: python lxml

我试图在服务器机器上安装Python 3的python-pptx(Red Hat 4.1.2-52)。我在安装它的依赖项lxml时遇到了一些麻烦。我试图单独安装所有依赖项(如建议的here)。

# sudo yum install -y gcc libxml2 libxml2-devel libxslt libxslt-devel python-devel
Setting up Install Process
Package gcc-4.1.2-55.el5.x86_64 already installed and latest version
Package libxml2-2.6.26-2.1.25.0.1.el5_11.x86_64 already installed and latest version
Package libxml2-2.6.26-2.1.25.0.1.el5_11.i386 already installed and latest version
Package libxml2-devel-2.6.26-2.1.25.0.1.el5_11.x86_64 already installed and latest version
Package libxml2-devel-2.6.26-2.1.25.0.1.el5_11.i386 already installed and latest version
Package libxslt-1.1.17-4.0.1.el5_8.3.x86_64 already installed and latest version
Package libxslt-1.1.17-4.0.1.el5_8.3.i386 already installed and latest version
Package libxslt-devel-1.1.17-4.0.1.el5_8.3.x86_64 already installed and latest version
Package libxslt-devel-1.1.17-4.0.1.el5_8.3.i386 already installed and latest version
Package python-devel-2.4.3-56.el5.x86_64 already installed and latest version
Package python-devel-2.4.3-56.el5.i386 already installed and latest version
Nothing to do

以下是来自# pip install lxml的完整追溯。

Downloading/unpacking lxml
  Downloading lxml-3.4.4.tar.gz (3.5MB): 3.5MB downloaded
  Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
    Building lxml version 3.4.4.
    Building without Cython.
    Using build configuration of libxslt 1.1.17
    Minimum required version of libxslt is 1.1.17, found 1.1.23
    Building against libxml2/libxslt in the following directory: /usr/lib64
    /usr/local/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)

    warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
  Running setup.py install for lxml
    Building lxml version 3.4.4.
    Building without Cython.
    Using build configuration of libxslt 1.1.17
    Minimum required version of libxslt is 1.1.17, found 1.1.23
    Building against libxml2/libxslt in the following directory: /usr/lib64
    building 'lxml.etree' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/local/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
    In file included from src/lxml/lxml.etree.c:239:
    /tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:19:4: error: #error minimum required version of libxml2 is 2.7.0
    /tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:28:4: error: #error minimum required version of libxslt is 1.1.23
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_9XMLParser___init__’:
    src/lxml/lxml.etree.c:103187: error: ‘XML_PARSE_HUGE’ undeclared (first use in this function)
    src/lxml/lxml.etree.c:103187: error: (Each undeclared identifier is reported only once
    src/lxml/lxml.etree.c:103187: error: for each function it appears in.)
    src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_10Schematron_6__call__’:
    src/lxml/lxml.etree.c:177038: error: ‘XML_SCHEMATRON_OUT_ERROR’ undeclared (first use in this function)
    /usr/local/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/local/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mrgef1x6-record/install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.4.4.

Building without Cython.

Using build configuration of libxslt 1.1.17

Minimum required version of libxslt is 1.1.17, found 1.1.23

Building against libxml2/libxslt in the following directory: /usr/lib64

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-3.4

creating build/lib.linux-x86_64-3.4/lxml

copying src/lxml/builder.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/__init__.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/cssselect.py -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/sax.py -> build/lib.linux-x86_64-3.4/lxml

creating build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/__init__.py -> build/lib.linux-x86_64-3.4/lxml/includes

creating build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/builder.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/defs.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/diff.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/clean.py -> build/lib.linux-x86_64-3.4/lxml/html

copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-3.4/lxml/html

creating build/lib.linux-x86_64-3.4/lxml/isoschematron

copying src/lxml/isoschematron/__init__.py -> build/lib.linux-x86_64-3.4/lxml/isoschematron

copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-3.4/lxml

copying src/lxml/includes/c14n.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xinclude.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xpath.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/uri.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/schematron.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/tree.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/xslt.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/config.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/relaxng.pxd -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/etree_defs.h -> build/lib.linux-x86_64-3.4/lxml/includes

copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.4/lxml/includes

creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources

creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng

copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/rng

creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl

creating build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build/temp.linux-x86_64-3.4

creating build/temp.linux-x86_64-3.4/src

creating build/temp.linux-x86_64-3.4/src/lxml

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/local/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w

In file included from src/lxml/lxml.etree.c:239:

/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:19:4: error: #error minimum required version of libxml2 is 2.7.0

/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:28:4: error: #error minimum required version of libxslt is 1.1.23

src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_9XMLParser___init__’:

src/lxml/lxml.etree.c:103187: error: ‘XML_PARSE_HUGE’ undeclared (first use in this function)

src/lxml/lxml.etree.c:103187: error: (Each undeclared identifier is reported only once

src/lxml/lxml.etree.c:103187: error: for each function it appears in.)

src/lxml/lxml.etree.c: In function ‘__pyx_pf_4lxml_5etree_10Schematron_6__call__’:

src/lxml/lxml.etree.c:177038: error: ‘XML_SCHEMATRON_OUT_ERROR’ undeclared (first use in this function)

/usr/local/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

error: command 'gcc' failed with exit status 1

任何想法我可能做错了什么?非常感谢提前!

如果有的话,这是this post的副本,也没有答案......但我们收到的错误消息略有不同。

2 个答案:

答案 0 :(得分:0)

我不使用红帽,但我的建议是遵循here的说明:

$(document).on('click', '.remove-document-upload', function() {
    $(this).closest('.addanother').remove();
})

这里的想法是你将安装一个虚拟环境并在其下使用pip包,这在依赖性方面很容易且更可靠。

答案 1 :(得分:0)

请不要使用sources.rhodecode.com和pypi.rhodecode.com它们很快就会消失:)我们不再在RhodeCode内部镜像我们的python内容。