python第三方库lxml源码安装
网络不行所以不能使用 pip install lxml或者easy_install lxml安装下载lxml
https://pypi.python.org/packages/source/l/lxml/lxml-3.3.3.tar.gz
解压后在解压文件下运行命令python setup.py install
提示缺少 Microsoft Visual C++ Compiler for Python 2.7
下载网址:http://www.microsoft.com/en-us/download/details.aspx?id=44266
继续执行报错:
lxml-3.3.3\src\lxml\includes\etree_defs.h(9) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
缺少libxml/xmlversion.h文件
下载libxml2已编译包:http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip
解压之后将include目录下的libxml文件夹(含xmlversion.h)拷贝到lxml-3.3.3\src\lxml\includes文件夹下
继续执行python setup.py install
报错:
lxml-3.3.3\src\lxml\includes\etree_defs.h(13) : fatal error C1083: Cannot open include file: 'libxslt/xsltconfig.h': No such file or directory
libxslt依赖libxml2所以要先装libxml2再装libxslt下载地址:
http://xmlsoft.org/sources/win32/libxslt-1.1.26.win32.zip
解压将include目录下的libxslt文件夹(含xsltconfig.h)和libexslt文件夹拷贝到lxml-3.3.3\src\lxml\includes文件夹下
继续执行python setup.py install
报错:
lxml-3.3.3\src\lxml\includes\libxml/encoding.h(28) : fatal error C1083: Cannot open include file: 'iconv.h': No such file or directory
iconv.hlinux系统有这文件,windows费劲
缺少iconv.h,下载地址:http://gnuwin32.sourceforge.net/packages/libiconv.htm
解压将libiconv-1.9.2-1-src\src\libiconv\1.9.2\libiconv-1.9.2\include文件夹下的iconv.h复制到lxml-3.3.3\src\lxml\includes文件夹下
LINK : fatal error LNK1181: cannot open input file 'libxslt.lib'
最后没安装成功放弃了,还是在linux下安装吧,国外论坛上有人说可以安装visual studio 2008就可以不需要这么麻烦,没实践过不知是否可行
页:
[1]