当前位置: 首页 > 面试题库 >

如何在Windows上安装LXML

逄兴昌
2023-03-14
问题内容

我正在尝试lmxl使用Python 3.4将其安装在Windows 8.1笔记本电脑上,但失败了。

首先,我尝试了简单明了的解决方案:pip install lxml。但是,这没有用。它是这样说的:

Downloading/unpacking lxml
  Running setup.py (path:C:\Users\CARTE_~1\AppData\Local\Temp\pip_build_carte_000\lxml\setup.py) egg_info for package lxml
    Building lxml version 3.4.2.
    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
    C:\Python34\lib\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.2.
    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
    building 'lxml.etree' extension
    C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    error: Unable to find vcvarsall.bat
    Complete output from command C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\CARTE_~1\\AppData\\Local\\Temp\\pip_build_carte_000\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\CARTE_~1\AppData\Local\Temp\pip-l8vvrv9g-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.4.2.

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.win32-3.4

creating build\lib.win32-3.4\lxml

copying src\lxml\builder.py -> build\lib.win32-3.4\lxml

copying src\lxml\cssselect.py -> build\lib.win32-3.4\lxml

copying src\lxml\doctestcompare.py -> build\lib.win32-3.4\lxml

copying src\lxml\ElementInclude.py -> build\lib.win32-3.4\lxml

copying src\lxml\pyclasslookup.py -> build\lib.win32-3.4\lxml

copying src\lxml\sax.py -> build\lib.win32-3.4\lxml

copying src\lxml\usedoctest.py -> build\lib.win32-3.4\lxml

copying src\lxml\_elementpath.py -> build\lib.win32-3.4\lxml

copying src\lxml\__init__.py -> build\lib.win32-3.4\lxml

creating build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\__init__.py -> build\lib.win32-3.4\lxml\includes

creating build\lib.win32-3.4\lxml\html

copying src\lxml\html\builder.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\clean.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\defs.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\diff.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\formfill.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\html5parser.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\soupparser.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\usedoctest.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\_html5builder.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\_setmixin.py -> build\lib.win32-3.4\lxml\html

copying src\lxml\html\__init__.py -> build\lib.win32-3.4\lxml\html

creating build\lib.win32-3.4\lxml\isoschematron

copying src\lxml\isoschematron\__init__.py -> build\lib.win32-3.4\lxml\isoschematron

copying src\lxml\lxml.etree.h -> build\lib.win32-3.4\lxml

copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.4\lxml

copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\config.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\tree.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\uri.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.4\lxml\includes

copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.4\lxml\includes

creating build\lib.win32-3.4\lxml\isoschematron\resources

creating build\lib.win32-3.4\lxml\isoschematron\resources\rng

copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-3.4\lxml\isoschematron\resources\rng

creating build\lib.win32-3.4\lxml\isoschematron\resources\xsl

copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-3.4\lxml\isoschematron\resources\xsl

copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-3.4\lxml\isoschematron\resources\xsl

creating build\lib.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-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.win32-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.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'

  warnings.warn(msg)

error: Unable to find vcvarsall.bat

----------------------------------------
Cleaning up...
Command C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\CARTE_~1\\AppData\\Local\\Temp\\pip_build_carte_000\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\CARTE_~1\AppData\Local\Temp\pip-l8vvrv9g-record\install-record.txt --single-version-externally-managed --compile failed with error code 1 in C:\Users\CARTE_~1\AppData\Local\Temp\pip_build_carte_000\lxml
Storing debug log for failure in C:\Users\carte_000\pip\pip.log

所以然后我看了一个很棒的有用的东西,叫做 互联网 ,很多人都需要libxml2和错误libxlst。他们推荐了一个叫Christoph
Gohlke的页面,其中他为一堆软件包提供了一些二进制工具。您可以在这里找到它(到lxml部分的快速链接)。

因此,在我放弃尝试为点子找到libxml2和libxslt之后,我决定去那里,发现
很多下载内容。我知道我需要一个64位的,但是我不知道cp我需要哪个。

因此,为我提供该pip方法的解决方案或Gohlke指数方法的答案都将是不错的。


问题答案:

首先,按照注释,我下载了lxml-3.4.2-cp34-none-win_amd64.whl文件并尝试使用来打开它pip install,但它只是告诉我它在我的系统上不是有效的wheel文件。

然后,我下载了win_32文件并成功了!也许是因为我拥有Intel处理器,毫不奇怪,AMD64仅适用于AMD处理器。



 类似资料:
  • 问题内容: 创建一个显示CSV文件中最新天气的网页后,我需要做一个项目。 我想了解一些详细的操作方法(不要真正获得http://flask.pocoo.org/docs/installation/#installation安装设置) 谁能介意简单地说明我的做法? 谢谢。 我在Windows 7和Windows Powershell上运行。 问题答案: Python 2.7.9+和3.4+ 好消息!

  • 问题内容: 我已按照此处的所有说明进行操作:http : //www.tonyspencer.com/2003/10/22/curl-with-php-and- apache-on-windows/ 要安装和配置apache,请获取PHP5软件包并获取CURL软件包。 我运行apache并运行PHP脚本。没问题。但是当我用curl运行php脚本时,它失败了。 它返回: 在第5行被称为 我输出php

  • 问题内容: 当我尝试使用以下命令在Windows上安装PyQt5时 我收到此错误: 我从PyQt5下载获得了pyQt5 。 如何安装PyQt5? 更新: 我从Qt下载页面安装,现在出现此错误: using the –verbose flag to see more detail about the problem. 当我执行命令时: qtdetail.m k qtdetail.pro nmake

  • 我试图在Windows 8.1 64位上安装Python 3.3的库。 问题是,要运行它的安装,我首先必须安装。 这就是一切都出问题的地方。 我在SO和internet上搜索了一下,发现问题来自。 我已经确保了在机器上安装了Visual Studio9编译器,但我真的不知道从那以后该怎么走... 有没有人在Windows 8.1 64位上成功地安装了这个库?这是一个全局问题还是真的特定于我需要执行

  • 我正在尝试在Windows上安装Kafka消息队列,以用于测试(而不是生产)。 我找到了这篇关于如何在Windows上安装Apache Kafka 0.8的文章:http://janschulte.wordpress.com/2013/10/13/apache-kafka-0-8-on-windows/ 这是一篇好文章,但不幸的是,它已经过时了。 有人知道实现这一目标的方法吗?