32

我正在尝试安装 libxml2,以便我可以设置 python 绑定并最终使用 lxml。

但是我无法在地球上工作,我应该解压缩文件。我无法成功谷歌。

我是否需要 Cygwin/MinGW 才能成功安装?

目前,我的 Python 文件夹中各自的目录中有 libxml2.tar.gz 和 libxslt.tar.gz 中的文件。因此,包含在 tar 中的文件位于 Python26\include\libxml2\libxml... 中,依此类推。

但是,当我运行 easy_install lxml 时,我收到以下输出:

Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.4
Downloading http://codespeak.net/lxml/lxml-2.2.4.tgz
Processing lxml-2.2.4.tgz
Running lxml-2.2.4\setup.py -q bdist_egg --dist-dir c:\users\rocco\appdata\local
\temp\easy_install-1xwbhy\lxml-2.2.4\egg-dist-tmp-9zwhe4
Building lxml version 2.2.4.
NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' need
s to be available.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt
warning: no files found matching 'lxml.etree.c' under directory 'src\lxml'
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxml'
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml'
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxml'
warning: no files found matching 'etree_defs.h' under directory 'src\lxml'
warning: no files found matching 'pubkey.asc' under directory 'doc'
warning: no files found matching 'tagpython*.png' under directory 'doc'
error: Setup script exited with error: Unable to find vcvarsall.bat

任何帮助都会非常有帮助,因为我已经尝试了一个多星期了:(

谢谢

4

5 回答 5

33

最新版本 lxml 的 Windows 二进制文件(以及各种其他 Python 包)可在http://www.lfd.uci.edu/~gohlke/pythonlibs/上获得

于 2012-01-29T20:04:47.640 回答
28

如果您没有特殊原因从源代码编译,您可以使用lxml 的预构建二进制文件

于 2009-12-15T01:57:42.077 回答
3

如果您使用的是 python 2.5.x,只需使用“ easy_install lxml==2.2.2 ”安装

于 2010-10-28T09:08:23.360 回答
3

意识到这是一个老话题,但在 Windows 上安装它时遇到了问题。

我有 Python 版本 3.4.4。

尝试安装 whl 文件时,请确保您使用的 python 版本正确。

所以在这种情况下我需要使用

lxml‑3.4.4‑cp34‑none‑win_amd64.whl

而不是最新的

lxml‑3.4.4‑cp35‑none‑win_amd64.whl

cp34 表示其构建的 python 版本。

新玩家的陷阱……!

于 2015-10-19T11:37:38.153 回答
0

看来程序“xslt-config”不在您的 PATH 环境中的目录中。这是一篇关于在 Windows 上设置 PATH 的文章:

http://www.cs.usask.ca/~wew036/latex/env.html

于 2009-12-15T01:59:39.997 回答