报废安装-lxml安装问题



我是Python的新手,我正在尝试安装scrapy,我在windows 10上有Python 2.7.12和pip 8.1.2。当我给出命令"pipinstall scrapy"时,它会尝试安装lxml,并给出以下错误。我下载了libxml2二进制文件,提取到一个文件夹中,并在路径变量中添加了bin文件夹。但仍然是同样的问题。请指导我处理这个问题,我被这个问题卡住了。下面提到了错误消息。

cl : Command line warning D9025 : overriding '/W3' with '/w'
lxml.etree.c
srclxmlincludesetree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
Compile failed: command 'C:\Users\myuserid\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2
creating users
creating usersmyuser~1
creating usersmyuser~1appdata
creating usersmyuser~1appdatalocal
creating usersmyuser~1appdatalocaltemp
C:UsersmyuseridAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCBincl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /Tcc:usersmyuser~1appdatalocaltempxmlXPathInita7i8_a.c /Fousersmyuser~1appdatalocaltempxmlXPathInita7i8_a.obj
xmlXPathInita7i8_a.c
c:usersmyuser~1appdatalocaltempxmlXPathInita7i8_a.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: command 'C:\Users\myuserid\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2
----------------------------------------
Command "c:softwarespython27python.exe -u -c "import setuptools, tokenize;__file__='c:\users\myuser~1\appdata\local\temp\pip-build-m4bvsr\lxml\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record c:usersmyuser~1appdatalocaltemppip-dnttln-recordinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:usersmyuser~1appdatalocaltemppip-build-m4bvsrlxml

您可以根据您的系统简单地使用其中一个whl文件。

下载后,在下载该文件的位置使用以下命令:

pip install ***.whl
Scrapy的文档摘要建议使用Anaconda安装软件包。在windows上安装Lxml包真的很难,而anaconda是一个非常简单的快捷方式。

在lxml的文档摘要中也提到了lxml的非官方二进制文件,您可以使用它来安装已经编译的lxml包。还有更多的说明,如何在windows操作系统上安装lxml。

您有什么版本的pip?只是升级pip有助于我的情况

pip install --upgrade pip

最新更新