如何在 Windows 上安装 lxml

2024-01-10

我正在尝试安装lmxl在我的 Windows 8.1 笔记本电脑上使用 Python 3.4 并惨遭失败。

首先,我尝试了简单明了的解决方案: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 and libxlst。他们推荐了一个叫 Christoph Gohlke 的页面,他为一堆包提供了某种二进制的东西。你可以找到它here http://www.lfd.uci.edu/~gohlke/pythonlibs/ (快速链接到 lxml 部分 http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml).

因此,在我放弃尝试为 pip 查找 libxml2 和 libxslt 后,我​​决定去那里,并发现绝对一吨下载次数。我知道我需要 64 位的,但我不知道是哪一个“cp“ 我需要。

所以答案要么给我一个解决方案pip方法或 Gohlke 指数方法会很棒。


或者您也可以前往Christoph 的 Gohlke 的 Python 页面 http://www.lfd.uci.edu/%7Egohlke/pythonlibs/#lxml然后下载正确的 lxml 文件。 (一般来说,因为我使用 python 3.4 并且我有 Windows,所以我下载了 lxml-3.4.4-cp34-none-win32.whl)

转到它所在的文件夹。单击背景(因此未选择任何内容),然后同时左移 + 右键单击​​,然后单击打开命令窗口。然后输入 C:/Python34/Scripts/pip install“您刚刚下载的文件的名称.whl”

在这种情况下,它将是 C:/Python34/Scripts/pip install "lxml-3.4.4-cp34-none-win32.whl"

现在按回车键。这对我来说效果很好,输入报价后,您还可以按 Tab 键,它应该填写适合您的报价。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Windows 上安装 lxml 的相关文章

随机推荐

  • 使用 group by 和聚合函数的简单 sql 到 Linq 查询

    我正在与 linq 进行斗争 试图学习语法 但我不知道如何执行以下简单查询 SELECT DISTINCT user firstname user lastname COUNT invoice amount SUM invoice amou
  • .Net Core WebAPI,无法使用 POSTMAN 发布数据,错误 - 415 不支持的 MediaType

    我正在使用 Postman 测试我的第一个 net Core WebAPI 发生未知媒体类型错误 我缺少什么 这是我的发帖对象 public class Country Key public int CountryID get set pu
  • 在共享 (.shproj) 项目中添加引用

    我在向共享项目添加 dll 引用时遇到问题 如下图所示 我有一个通用解决方案 其中包含一个 Windows 项目和一个 Windows Phone 项目 在 HubApp1 Shared 项目中 我需要在 Class cs 中添加一些代码的
  • 如何将 DataReader 中的值放入 List 中? [复制]

    这个问题在这里已经有答案了 可能的重复 如何轻松地将 DataReader 转换为 List https stackoverflow com questions 1464883 how can i easily convert datare
  • 使用数学函数获取整数值

    我有一些 LessCSS 本质上是这样的 foo height 20px iconHeight 13px background position 0 height iconHeight 2 然而 这显然是background positio
  • 如何获取EL中当前组件的id

    我正在使用 JSF 和 PrimeFaces 但我需要获取组件 id 的值 因为我正在构建具有不同 id 的动态面板 所以要显示面板 我需要比较是否是当前面板 然后显示它 例如 如果我有下一个面板
  • 从 UWP 项目引用 .NETStandard 2.0 项目

    我正在构建一个 Xamarin 应用程序 并且已在 NETStandard 2 0 类库中实现了核心 使用 Xamarin Forms 它被实现平台特定代码的 iO 和 Android 项目正确引用 问题是 我尝试添加 UWP 项目以便我的
  • relplot seaborn 中的图例大小/标记

    我一直在寻找增加 relplot 中的图例 色调大小的方法 plt rcParams axes labelsize 20 g sns relplot x Time days y Duration Total s hue Outcome da
  • 企业库滚动平面文件未滚动

    我正在尝试轮换日志文件 每周轮换一个 但此配置文件不起作用 如果我将其更改为轮换而不是午夜到分钟 它只会记录一个持续时间为一分钟的单个文件 没有生成新文件 最新版本的企业库是否存在任何已知的错误 这些错误主要集中在滚动平面文件不起作用 我现
  • 在 MAC OS X 10.9.2 上安装 Rails 时遇到问题

    在 Mac 上安装 Rails 时遇到问题 想知道是否有人可以帮助我 dannys mbp 2 Danny1 sudo gem install rails 构建本机扩展 这可能需要一段时间 错误 安装导轨时出错 错误 无法构建 gem 本机
  • 获取对象的AppDomain

    有什么方法可以确定在哪个 AppDomain 中创建了对象或 ObjectHandle 实例 如果您的对象使用 例如 序列化从另一个应用程序域 旅行 到当前应用程序域 那么它本质上是在您当前的应用程序域中 创建 的 源 AppDomain
  • 如何使用VBA查找一个范围是否包含在另一个范围中?

    我在比较两个范围时遇到问题 为了简单起见 我将采用两个简单的范围M6 M10 and M6 M8 我想知道第二个是否包含在第一个中 我想的第一件事是写 Sub example Dim range1 range2 inte As range
  • AWS EBS 中的 ASP.Net Core - 写入权限和 .ebextensions

    我们已在 AWS EBS 上部署了 ASP Net Core 应用程序 但在其上写入文件时遇到问题 访问路径C inetpub AspNetCoreWebApps app App Data file txt被拒绝 I added ebext
  • 使用 OTP 的 Firebase 电话身份验证在发布版本中不起作用

    我在 Android 应用程序中使用 Firebase SDK 进行电话身份验证 OTP 验证 这在调试版本上运行良好 但在发布版本上则不然 在 firebase 项目中添加了我的调试 SHA 1 指纹 在 firebase 项目中添加了我
  • 在 C++17/20 中迭代元组[重复]

    这个问题在这里已经有答案了 有谁知道在 C 17 20 中迭代元组的好 干净的方法吗 假设我们有一些这样的代码 class Test public Test int x x x void Go const std cout lt lt Hi
  • 我的二进制间隙代码解决方案是否正确?那我应该改进什么?

    正整数 N 内的二进制间隙是 N 的二进制表示中两端都被 1 包围的连续零的最大序列 例如 数字 9 具有二进制表示形式 1001 并且包含长度为 2 的二进制间隙 数字 529 具有二进制表示形式 1000010001 并且包含两个二进制
  • java.lang.NullPointerException Hibernate 与 Ehcache 一起使用

    我使用了 Hibernate 4 1 2 和 Ehcache 2 4 3 下载 hibernate 时与 hibernate 一起提供 我的 hibernate cfg xml
  • 有没有办法获取应用于 HTML 片段或页面的所有 CSS 的列表?

    我知道使用 Firefox 的 Firebug 扩展等工具很容易获得应用于 HTML 中单个节点的 CSS 但有没有办法看到all对整个页面或较大的 HTML 片段有效的 CSS 具体来说 我们正在将一个非常大的 CSS 文件清理为较小的模
  • C++ 中 Java 风格的“double”打印

    是否有任何流操纵器的组合 或标准 C 中的任何其他方法 可以让我在打印时获得 正确 的位数double in C 我所说的 正确 数字是指定义的位数here https docs oracle com javase 7 docs api j
  • 如何在 Windows 上安装 lxml

    我正在尝试安装lmxl在我的 Windows 8 1 笔记本电脑上使用 Python 3 4 并惨遭失败 首先 我尝试了简单明了的解决方案 pip install lxml 然而 这并没有奏效 它是这样说的 Downloading unpa