python - 无法在 Windows 上安装 lxml, fatal error C1083 : Cannot open include file: 'libxml/xmlversion.h'

标签 python python-3.x scrapy lxml

Python 新手,请多多包涵。我使用来自 www.python.org 的 v3.5.1 的 python 安装程序。我的目的是使用 Scrapy 来运行一些脚本。

pip install scrapy 失败,easy_install scrapy 和其他人也是如此。我将错误追溯到错误的 lxml 安装。这是错误日志。我什至尝试过 easy_installing libxml2,我不确定如何继续。

Building lxml version 3.5.0.
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
cl : Command line warning D9025 : overriding '/W3' with '/w'
lxml.etree.c
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 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
xmlXPathInitck3f6zpk.c
C:\Users\Rohan\AppData\Local\Temp\easy_install-47utdost\lxml-3.5.0\temp\xmlXPathInitck3f6zpk.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

最佳答案

我遇到了同样的问题,尽管使用的是 WinPython 64 位 2.7.3.1。

我使用预编译的安装程序解决了这个问题,可以在这里找到:https://pypi.python.org/pypi/lxml/3.3.3#downloads

通过运行 .exe 直接安装包失败,因为安装程序找不到我的 python 安装(尽管它已注册)。 然而,我随后成功地使用 WinPython 控制面板安装了软件包!

编辑:在此之前,我尝试了在 stackoverflow 上找到的各种东西,包括安装一些 Visual C++ (Python) 编译器,但都没有用。

关于python - 无法在 Windows 上安装 lxml, fatal error C1083 : Cannot open include file: 'libxml/xmlversion.h' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34536149/

相关文章:

python - 连接具有不同日期时间频率的数据帧

python - 如何在其派生类中覆盖列表的切片功能

python - 在 C++ 库中调用 exit() 会终止使用 swig 包装该库的 python 脚本

python-3.x - Python 非阻塞服务器

python - 是否可以从 scrapys 调度程序队列中删除请求?

python - 改变 networkx/matplotlib 力图中的边长和簇间距

python - 权限错误: [Errno 13] Permission denied (after multiple successful writting attemps in the file)

python - 给定两个字符串列表,如何将它们转换为字典?

python - 使用多个键填充Scrapy项目: value pair

python - scrapy 有没有办法在不使用 -o -t 参数的情况下打印 json 文件