lxml包引入错误

     在使用第三方包lxml引入etree模块时报错:

>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (initetree)
   由于之前安装是直接使用源码包进行安装,报错之后决定卸载掉源码安装的版本(直接删除site-packages目录下面的lxml包文件),然后重新使用easy_insall命令安装,安装过程中报错信息如下:

ERROR: /bin/sh: xslt-config: command not found

** make sure the development packages of libxml2 and libxslt are installed **
    于是分别安装libxml2 and libxslt模块:

 1027  yum install libxml2
 1028  yum install libxslt
   检查xslt-config命令是否安装成功:

[root@oser623 mongodb]# whereis xslt-config
xslt-config: 
[root@oser623 mongodb]# 
   xslt-config命令还是不存在,在网上找了找资料,提示说需要安装 libxslt-devel
 1033  yum install libxslt-devel
   现在再来尝试安装 lxml模块

[root@oser623 mongodb]# whereis xslt-config
xslt-config: /usr/bin/xslt-config
[root@oser623 mongodb]# easy_install lxml  
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3.4
Downloading http://lxml.de/files/lxml-2.3.4.tgz
Processing lxml-2.3.4.tgz
Running lxml-2.3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-zdolOV/lxml-2.3.4/egg-dist-tmp-QQHSfi
Building lxml version 2.3.4.
Building without Cython.
Using build configuration of libxslt 1.1.17
Building against libxml2/libxslt in the following directory: /usr/lib64
Adding lxml 2.3.4 to easy-install.pth file

Installed /usr/lib/python2.4/site-packages/lxml-2.3.4-py2.4-linux-x86_64.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
   包导入测试:

[root@oser623 mongodb]# python
Python 2.4.3 (#1, Feb 22 2012, 16:05:45) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> 
  安装成功!




  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值