安装libxml2和相关的python绑定 - Windows

Roc*_*cco 31 python windows libxml2

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

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

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

目前,我将libxml2.tar.gz和libxslt.tar.gz中的文件放在Python文件夹中各自的目录中.因此,包含在包含的变量中的文件位于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
Run Code Online (Sandbox Code Playgroud)

任何帮助都会非常有帮助,因为我一直试图让这个持续一周以上:(

谢谢

chu*_*kus 33

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

  • +1:Python 2.7的二进制文件可在此站点获得,但不能在pypi上获得 (6认同)
  • 它说32和64.所以我下载了64,然后它说:lxml-3.6.4-cp27-cp27m-win_amd64.whl不是这个平台上支持的轮子.所以我安装了32个.它的工作原理! (2认同)

YOU*_*YOU 28

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

  • 为什么当我尝试执行`pip install lxml`或`easy_install lxml`时,它会尝试从源代码构建?我可以让pip下载预先构建的二进制文件吗? (11认同)
  • @Mridang`easy_install URL_TO_EGG`来安装预建的二进制文件.在pypi页面或其他站点上获取正确的URL:http://pypi.python.org/pypi/lxml/2.2.2 (3认同)