如何在.virtualenvs上安装libxml2-python-2.6.9.tar.gz

时间:2013-09-16 09:48:59

标签: python django virtualenv

在virtualenvs中安装libxml2时出现以下错误:

Fatal error: local() encountered an error (return code 1) while executing 'pip install ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.9.tar.gz'

有关错误消息的更多信息:

 Downloading libxml2-python-2.6.9.tar.gz (201kB): 201kB downloaded
  Running setup.py egg_info for package from ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.9.tar.gz
    /usr/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
      warnings.warn(msg)
    Found 1466 functions in libxml2-api.xml
    Found 51 functions in libxml2-python-api.xml
    Generated 824 wrapper functions, 489 failed, 204 skipped

    Missing type converters:
    xmlInputMatchCallback:1  xmlXPathFuncLookupFunc:1  xmlNotationTablePtr:2  xmlXPathObjectPtr:22  xmlLocationSetPtr:6  xmlEnumerationPtr:5  xmlElementTablePtr:2  const htmlEntityDesc *:2  xmlChar **:15  xmlXPathCompExprPtr:5  xmlDocPtr *:1  xmlTextReaderErrorFunc:1  xmlOutputMatchCallback:1  xmlExternalEntityLoader:2  xmlRelaxNGValidityErrorFunc *:2  xmlPatternPtr:3  xmlEntitiesTablePtr:3  xmlStructuredErrorFunc:1  xmlNsPtr *:1  xmlBufferAllocationScheme:3  xmlEnumerationPtr *:2  const xmlParserNodeInfo *:1  xmlXPathVariableLookupFunc:1  xmlShellCtxtPtr:10  xlinkNodeDetectFunc:2  xmlSchemaTypePtr:5  xmlRefTablePtr:1  xmlParserNodeInfoPtr:1  xmlAttributeTablePtr:2  xmlCharEncodingHandler *:4  xmlXIncludeCtxtPtr:4  xmlRelaxNGValidityErrorFunc:2  xmlParserNodeInfoSeqPtr:3  xmlSchemaFacetPtr:3  xmlTextReaderErrorFunc *:1  xmlOutputWriteCallback:2  xlinkHandlerPtr:2  xmlSchemaParserCtxtPtr:6  xmlValidCtxtPtr:25  xmlRegExecCallbacks:1  size_t:1  xmlDeregisterNodeFunc:2  xmlChRangeGroupPtr:1  va_list:1  xmlSAXHandler *:4  xmlSchemaValPtr:2  ...:1  xmlShellReadlineFunc:1  xmlDict *:1  htmlElemDesc *:3  xmlCharEncodingHandlerPtr:7  xmlNodePtr *:1  xmlCharEncodingInputFunc:1  xmlAutomataPtr:16  xmlEntityReferenceFunc:1  xmlInputReadCallback:7  xmlC14NIsVisibleCallback:1  xmlAttributeType:1  char **:5  xmlXPathFunction:4  xmlCharEncoding:12  xmlNodeSetPtr:32  xmlParserInputPtr:17  htmlStatus:1  xmlSchemaPtr:3  xmlRegisterNodeFunc:2  xmlIDTablePtr:1  xmlRegExecCtxtPtr:3  xmlElementContentPtr *:1  xmlCatalogAllow:2  xmlElementContentType:1  xmlElementContent *:1  xmlDictPtr:8  void *:89  xmlTextWriterPtr:77  xmlSchemaValidCtxtPtr:4  xmlCatalogPrefer:1  xmlElementContentPtr:6  xmlNotationPtr:1  const htmlElemDesc *:1  xlinkType:1  xmlGenericErrorFunc *:1  xmlSaveCtxtPtr:6
    Found 214 functions in libxslt-api.xml
    Found 27 functions in libxslt-python-api.xml
    Generated 125 wrapper functions, 83 failed, 33 skipped

    Missing type converters:
    xsltTopLevelFunction:2  xsltDecimalFormatPtr:2  xmlChar **:2  xmlXPathCompExprPtr:4  xsltPreComputeFunction:1  xsltElemPreCompPtr:2  xsltDebugTraceCodes:2  xsltSecurityPrefsPtr:11  xsltSortFunc:2  xsltTemplatePtr:4  pythonObject *:4  ...:1  xsltNumberDataPtr:1  xmlNodePtr *:3  xsltExtInitFunction:2  char **:2  xmlXPathObjectPtr *:1  xmlNodeSetPtr:2  xmlXPathFunction:4  xsltTransformFunction:5  xsltCompMatchPtr:3  void *:10  xmlOutputBufferPtr:1  xmlHashTablePtr:1  xmlDictPtr:1  xsltDocumentPtr:7  xsltStackElemPtr:3

Installing collected packages: libxml2-python
  Running setup.py install for libxml2-python
    /usr/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
      warnings.warn(msg)
    building 'libxml2mod' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT=1 -DMERGED_MODULES=1 -I/usr/include/libxml2 -I/usr/include -I/usr/include/libxslt -I/usr/include/python2.7 -c libxml2-py.c -o build/temp.linux-x86_64-2.7/libxml2-py.o
    libxml2-py.c: In function ‘libxml_xmlUTF8Strpos’:
    libxml2-py.c:11913:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT=1 -DMERGED_MODULES=1 -I/usr/include/libxml2 -I/usr/include -I/usr/include/libxslt -I/usr/include/python2.7 -c libxml.c -o build/temp.linux-x86_64-2.7/libxml.o
    libxml.c: In function ‘pythonStartElement’:
    libxml.c:624:13: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c:636:21: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c: In function ‘libxml_xmlParserCtxtGetErrorHandler’:
    libxml.c:1562:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c:1564:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c: In function ‘libxml_xmlTextReaderGetErrorHandler’:
    libxml.c:1716:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c:1718:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
    libxml.c: In function ‘libxml_serializeNode’:
    libxml.c:2466:28: error: dereferencing pointer to incomplete type
    libxml.c:2467:33: error: dereferencing pointer to incomplete type
    libxml.c:2468:22: error: dereferencing pointer to incomplete type
    libxml.c:2470:30: error: dereferencing pointer to incomplete type
    libxml.c:2471:35: error: dereferencing pointer to incomplete type
    libxml.c:2472:24: error: dereferencing pointer to incomplete type
    libxml.c:2501:32: error: dereferencing pointer to incomplete type
    libxml.c:2502:37: error: dereferencing pointer to incomplete type
    libxml.c:2503:26: error: dereferencing pointer to incomplete type
    libxml.c:2505:34: error: dereferencing pointer to incomplete type
    libxml.c:2506:39: error: dereferencing pointer to incomplete type
    libxml.c:2507:28: error: dereferencing pointer to incomplete type
    libxml.c:2542:32: error: dereferencing pointer to incomplete type
    libxml.c:2543:37: error: dereferencing pointer to incomplete type
    libxml.c:2544:26: error: dereferencing pointer to incomplete type
    libxml.c:2546:34: error: dereferencing pointer to incomplete type
    libxml.c:2547:39: error: dereferencing pointer to incomplete type
    libxml.c:2548:28: error: dereferencing pointer to incomplete type
    libxml.c: In function ‘initlibxml2mod’:
    libxml.c:3213:15: warning: variable ‘m’ set but not used [-Wunused-but-set-variable]
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/marko/.virtualenvs/jb-backend/bin/python -c "import setuptools;__file__='/tmp/pip-pW8UbM-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-TJ_Dac-record/install-record.txt --single-version-externally-managed --install-headers /home/marko/.virtualenvs/jb-backend/include/site/python2.7:
    /usr/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'

  warnings.warn(msg)

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying libxml2.py -> build/lib.linux-x86_64-2.7

copying drv_libxml2.py -> build/lib.linux-x86_64-2.7

copying libxslt.py -> build/lib.linux-x86_64-2.7

running build_ext

building 'libxml2mod' extension

creating build/temp.linux-x86_64-2.7

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT=1 -DMERGED_MODULES=1 -I/usr/include/libxml2 -I/usr/include -I/usr/include/libxslt -I/usr/include/python2.7 -c libxml2-py.c -o build/temp.linux-x86_64-2.7/libxml2-py.o

libxml2-py.c: In function ‘libxml_xmlUTF8Strpos’:

libxml2-py.c:11913:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT=1 -DMERGED_MODULES=1 -I/usr/include/libxml2 -I/usr/include -I/usr/include/libxslt -I/usr/include/python2.7 -c libxml.c -o build/temp.linux-x86_64-2.7/libxml.o

libxml.c: In function ‘pythonStartElement’:

libxml.c:624:13: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c:636:21: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c: In function ‘libxml_xmlParserCtxtGetErrorHandler’:

libxml.c:1562:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c:1564:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c: In function ‘libxml_xmlTextReaderGetErrorHandler’:

libxml.c:1716:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c:1718:2: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]

libxml.c: In function ‘libxml_serializeNode’:

libxml.c:2466:28: error: dereferencing pointer to incomplete type

libxml.c:2467:33: error: dereferencing pointer to incomplete type

libxml.c:2468:22: error: dereferencing pointer to incomplete type

libxml.c:2470:30: error: dereferencing pointer to incomplete type

libxml.c:2471:35: error: dereferencing pointer to incomplete type

libxml.c:2472:24: error: dereferencing pointer to incomplete type

libxml.c:2501:32: error: dereferencing pointer to incomplete type

libxml.c:2502:37: error: dereferencing pointer to incomplete type

libxml.c:2503:26: error: dereferencing pointer to incomplete type

libxml.c:2505:34: error: dereferencing pointer to incomplete type

libxml.c:2506:39: error: dereferencing pointer to incomplete type

libxml.c:2507:28: error: dereferencing pointer to incomplete type

libxml.c:2542:32: error: dereferencing pointer to incomplete type

libxml.c:2543:37: error: dereferencing pointer to incomplete type

libxml.c:2544:26: error: dereferencing pointer to incomplete type

libxml.c:2546:34: error: dereferencing pointer to incomplete type

libxml.c:2547:39: error: dereferencing pointer to incomplete type

libxml.c:2548:28: error: dereferencing pointer to incomplete type

libxml.c: In function ‘initlibxml2mod’:

libxml.c:3213:15: warning: variable ‘m’ set but not used [-Wunused-but-set-variable]

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command /home/marko/.virtualenvs/jb-backend/bin/python -c "import setuptools;__file__='/tmp/pip-pW8UbM-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-TJ_Dac-record/install-record.txt --single-version-externally-managed --install-headers /home/marko/.virtualenvs/jb-backend/include/site/python2.7 failed with error code 1 in /tmp/pip-pW8UbM-build
Storing complete log in /home/marko/.pip/pip.log

Fatal error: local() encountered an error (return code 1) while executing 'pip install ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.9.tar.gz'

任何想法? 非常感谢

3 个答案:

答案 0 :(得分:1)

尝试此解决方案:https://pkimber.net/howto/python/pip/install-modules.html

激活你的python虚拟环境......

构建并安装:

$ wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
$ tar xf libxml2-2.9.1.tar.gz
$ cd libxml2-2.9.1
$ ./configure
$ make
$ cd python
(virtenv)$ python setup.py install

答案 1 :(得分:0)

sudo apt-get install libxslt1-dev

答案 2 :(得分:0)

这可能是由于libxml2-python与系统libxml2libxslt1.1之间的版本不匹配。

最近,我在Ubuntu Trusty(14.04)上安装libxml2-python-2.6.21时遇到了同样的问题。我发现绑定取决于libxml2版本 2.7.8 libxslt1.1版本 1.1.26 。但该版本分别在版本 2.9.1 1.1.28 上有libxml2libxslt1.1

我有两种方法可以解决这个问题:

  1. 从来源[0]构建libxml2libxslt1.1

    # update system
    apt-get -y -qq --force-yes update
    
    # install needed system deps
    apt-get -y -qq --force-yes install \
        python-setuptools \
        build-essential \
        wget \
        python-dev \
        zlib1g-dev
    
    # download libxml2 and libxslt1.1
    mkdir /opt/src \
        && cd /opt/src \
        && wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz \
        && wget ftp://xmlsoft.org/libxslt/libxslt-1.1.26.tar.gz \
        && tar -xzf libxml2-2.7.8.tar.gz \
        && cd /opt/src/libxml2-2.7.8 \
            && ./configure && make && make install \
        && cd /opt/src \
        && tar -xzf libxslt-1.1.26.tar.gz \
        && cd /opt/src/libxslt-1.1.26 \
            && ./configure && make && make install \
        && ldconfig -v
    
    # install pip
    easy_install pip
    
    # install offending package
    wget ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.21.tar.gz
    pip install libxml2-python-2.6.21.tar.gz
    
    # install othe package that depends upon libxml2 and libxslt1.1
    pip install lxml
    
  2. 使用来自Ubuntu Precise源[1]的libxml2libxslt1.1

    # enable precise source
    echo "deb http://archive.ubuntu.com/ubuntu precise main universe" \
        >> /etc/apt/sources.list
    
    # update system
    apt-get -y -qq --force-yes update \
    
    # install needed deps
    apt-get -y -qq --force-yes install \
        python-setuptools \
        build-essential \
        wget \
        python-dev \
        libxml2/precise \
        libxml2-dev/precise \
        libxslt1.1/precise \
        libxslt1-dev/precise \
        zlib1g-dev
    
    # install package that depends upon libxml2 and libxslt1.1 to show that both
    # will not be upgraded
    apt-get -y -qq --force-yes install \
        libxmlsec1 \
        libxmlsec1-dev \
        libxmlsec1-openssl
    
    # install pip
    easy_install pip
    
    # install offending package
    wget ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.21.tar.gz
    pip install libxml2-python-2.6.21.tar.gz
    
    # install other binding that depends on libxml2 and libxslt1.1
    pip install lxml
    
  3. 嗯,希望它可以帮到你。

    [0] https://gist.github.com/joaodubas/bbf6f9a990d8169ae0bf

    [1] https://gist.github.com/joaodubas/d14aaba905757e72d9a0