无法在库libxml2中找到函数xmlCheckVersion。是否在Python3中安装了libxml2?

问题描述 投票:-1回答:1

我试图在Windows 10中运行pip install lxm时遇到此错误.lxml的任何先决条件?

C:\Python37-32\Scripts>pip install lxml
Collecting lxml
  Using cached https://files.pythonhosted.org/packages/54/a6/43be8cf1cc23e3fa208cab04ba2f9c3b7af0233aab32af6b5089122b44cd/lxml-4.2.3.tar.gz
Installing collected packages: lxml
  Running setup.py install for lxml ... error
    Complete output from command c:\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-12zn4_mn\\lxml\\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\hp\AppData\Local\Temp\pip-record-ag0n7oku\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 4.2.3.
    Building without Cython.
    ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
    ** make sure the development packages of libxml2 and libxslt are installed **

    Using build configuration of libxslt
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\lxml
    copying src\lxml\builder.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\cssselect.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\sax.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\usedoctest.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\_elementpath.py -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\__init__.py -> build\lib.win-amd64-3.7\lxml
    creating build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win-amd64-3.7\lxml\includes
    creating build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-3.7\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win-amd64-3.7\lxml\html
    creating build\lib.win-amd64-3.7\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-3.7\lxml\isoschematron
    copying src\lxml\etree.h -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\etree_api.h -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\lxml.etree.h -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-3.7\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-3.7\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-3.7\lxml\includes
    creating build\lib.win-amd64-3.7\lxml\isoschematron\resources
    creating build\lib.win-amd64-3.7\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\rng
    creating build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl
    creating build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\src
    creating build\temp.win-amd64-3.7\Release\src\lxml
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -Ic:\python37-32\include -Ic:\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-3.7\Release\src\lxml\etree.obj -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    etree.c
    c:\users\hp\appdata\local\temp\pip-install-12zn4_mn\lxml\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
    Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    creating Users
    creating Users\hp
    creating Users\hp\AppData
    creating Users\hp\AppData\Local
    creating Users\hp\AppData\Local\Temp
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /TcC:\Users\hp\AppData\Local\Temp\xmlXPathInitws24hybn.c /FoUsers\hp\AppData\Local\Temp\xmlXPathInitws24hybn.obj
    xmlXPathInitws24hybn.c
    C:\Users\hp\AppData\Local\Temp\xmlXPathInitws24hybn.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************

    ----------------------------------------
Command "c:\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-12zn4_mn\\lxml\\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\hp\AppData\Local\Temp\pip-record-ag0n7oku\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\hp\AppData\Local\Temp\pip-install-12zn4_mn\lxml\
python windows python-3.x lxml
1个回答
0
投票

您缺少libxml2,这是使用lxml的要求。请参阅:

https://lxml.de/installation.html

具体来说,正如lxml的维护者在网站上写道:

对于MS Windows,最近的lxml版本包含社区捐赠的二进制发行版,尽管您可能仍希望查看相关的FAQ条目。如果您无法在我们发布的已签名和测试的源上在MS Windows系统上构建lxml,请考虑使用PyPI的二进制构建或Christoph Gohlke慷慨提供的unofficial Windows binaries

简而言之,您缺少lxml所需的重要C库。也可以看看:

How to install lxml on Windows

© www.soinside.com 2019 - 2024. All rights reserved.