安装lxml总是失败解决方法
失败提示如下:
running build_ext
building 'lxml.etree' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\src
creating build\temp.win-amd64-2.7\Release\src\lxml
C:\Users\wenshiwei\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc\lxml\inc
ludes -Ic:\apps\tools\python27\include -Ic:\apps\tools\python27\PC /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win-amd64-2.7\Release\src\lxml\lxml.etree.obj -w
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:\\Users\\wenshiwei\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with
exit status 2
C:\Users\wenshiwei\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include
/libxml2 /Tcc:\users\wenshi~1\appdata\local\temp\xmlXPathInitqpboxi.c /Fousers\wenshi~1\appdata\local\temp\xmlXPathInitqpboxi.obj
xmlXPathInitqpboxi.c
c:\users\wenshi~1\appdata\local\temp\xmlXPathInitqpboxi.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\\wenshiwei\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit stat
us 2
----------------------------------------
Command "c:\apps\tools\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\wenshi~1\\appdata\\local\\temp\\pip-build-mavckn\\lxml\\setup
.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\
wenshi~1\appdata\local\temp\pip-jal9v1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\wenshi~1\ap
pdata\local\temp\pip-build-mavckn\lxml\
pip install wheel
接着下载 相应的.whl包
下载地址 http://www.lfd.uci.edu/~gohlke/pythonlibs