scrapy 无法在Windows上安装lxml,严重错误C1083:无法打开包含文件:'libxml/xmlversion.h'

j9per5c4  于 2022-11-09  发布在  Windows
关注(0)|答案(3)|浏览(150)

Python菜鸟,请耐心听我说。我使用了来自www.python.org的python v3.5.1安装程序。我的目的是使用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
vfh0ocws

vfh0ocws1#

我遇到了同样的问题,尽管使用的是WinPython 64位2.7.3.1。
我使用预编译的安装程序解决了这个问题,可以在这里找到:https://pypi.python.org/pypi/lxml/3.3.3#downloads
通过运行.exe直接安装软件包失败,因为安装程序找不到我的python安装(尽管它是注册的)。然而,我随后成功地使用Winpython控制面板安装了软件包!
编辑:在此之前,我尝试了各种我在stackoverflow上找到的东西,包括安装一些Visual C++(Python)编译器,但都不起作用。

uinbv5nw

uinbv5nw2#

我在Windows 10上使用Python 64位2.7.11时也遇到了同样的问题。
在我尝试安装scrapy使用pip多次,我有如下成功:
1.首先我安装了来自.exe文件的预编译包lxml v3.6.0。它可以在这里找到https://pypi.python.org/pypi/lxml/3.6.0
1.最后,我再次运行pip install scrapy,安装成功结束。
黑客快乐!

tvokkenx

tvokkenx3#

我不能使用PYPY来安装这个包,但是我可以使用普通的pip.所以我进入我的文件系统,从python39〉lib中取出lxml文件,并将它们复制粘贴到我的pypy〉lib文件中.这些文件是:lxml lxml-4.8.0.远端信息

相关问题