Windows下Python安装lxml 3.4.4

简介: 推荐安装方式:命令行安装pip install lxml==3.4.4easy_install lxml==3.4.4会自动下载lxml-3.4.4-cp27-none-win32.whl安装cp27表示是python2.7不指定版本号的话,默认会下载最新版(3.5.0)源码编译安装,编译过程中会提示缺少libxml2和libxslt依赖github源码地址:https://gi

推荐安装方式:命令行安装

pip install lxml==3.4.4

easy_install lxml==3.4.4

会自动下载lxml-3.4.4-cp27-none-win32.whl安装

cp27表示是python2.7

不指定版本号的话,默认会下载最新版(3.5.0)源码编译安装,编译过程中会提示缺少libxml2和libxslt依赖


github源码地址:https://github.com/lxml/lxml

lxml官网:http://lxml.de/installation.html#source-builds-on-ms-windows


参考文章:

http://blog.csdn.net/anwenxixi/article/details/45332435



不推荐安装方式:源码安装


下载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.h  linux系统有这文件,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就可以不需要这么麻烦,没实践过不知是否可行


参考文章:

python第三方库lxml源码安装&&使用笔记

http://www.360doc.com/content/14/1203/17/18578054_430141004.shtml


本文出自 “点滴积累” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1726574

目录
相关文章
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows Server 2012 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows Server 2012 操作系统保姆级教程(附链接)
55 0
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows Server 2003 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows Server 2003 操作系统保姆级教程(附链接)
47 0
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
80 0
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows XP 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows XP 操作系统保姆级教程(附链接)
109 0
|
1月前
|
数据可视化 Python Windows
使用 Python 代码在 windows 控制台打印正弦三角函数
使用 Python 代码在 windows 控制台打印正弦三角函数
18 0
|
1月前
|
关系型数据库 MySQL Python
python安装MySQL-python:EnvironmentError解决办法
python安装MySQL-python:EnvironmentError解决办法
29 1
|
11天前
|
人工智能 机器人 C++
【C++/Python】Windows用Swig实现C++调用Python(史上最简单详细,80岁看了都会操作)
【C++/Python】Windows用Swig实现C++调用Python(史上最简单详细,80岁看了都会操作)
|
17天前
|
安全 Windows
安装MyEclipse遇到错误提示 Failed to find a Main Class in “C:Windows\Temp\“时的解决方案
安装MyEclipse遇到错误提示 Failed to find a Main Class in “C:Windows\Temp\“时的解决方案
22 1
|
8天前
|
Ubuntu Python
python3安装clickhouse_sqlalchemy(greenlet) 失败
如果上述方法仍然无法解决问题,建议查阅相关错误信息和官方文档,以获取更详细的帮助。确保你的Python环境和依赖库都在最新版本,有时问题可能会因为版本不兼容而导致安装失败。
14 0
|
11天前
|
数据采集 机器学习/深度学习 人工智能
Python环境搭建—安装Python3解释器
Python环境搭建—安装Python3解释器
31 2

热门文章

最新文章