为什么不能安装python_为什么我不能为Python安装lxml?

I have downloaded the tarball for lxml and am using ipython setup.py install to try to install it. Unfortunately it is giving me screenfuls of error messages:

src/lxml/lxml.etree.c:200651: error: ‘XML_XPATH_INVALID_OPERAND’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200661: error: ‘XML_XPATH_INVALID_TYPE’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200671: error: ‘XML_XPATH_INVALID_ARITY’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200681: error: ‘XML_XPATH_INVALID_CTXT_SIZE’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200691: error: ‘XML_XPATH_INVALID_CTXT_POSITION’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200921: error: ‘LIBXSLT_VERSION’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200933: error: ‘xsltLibxsltVersion’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200945: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200945: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200954: error: ‘xsltDocLoaderFunc’ undeclared (first use in this function)

src/lxml/lxml.etree.c:200954: error: expected ‘)’ before ‘__pyx_f_4lxml_5etree__xslt_doc_loader’

An exception has occurred, use %tb to see the full traceback.

SystemExit: error: command 'gcc' failed with exit status 1

Does anyone know what is going on here? Apparently cython can interfere with installation, but I don't have cython installed on my system. This is on a centos 6.4 operating system, with ipython running 2.7.

解决方案

lxml depends on libxml2 and libxslt. Use yum to install the development headers:

yum install libxml2-devel libxslt-devel python-devel

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值