python lxml异入不了etree_将lxml.etree导入python时出现错误

i have installed an lxml on my mac, when i type in python like this

localhost:lxml-3.0.1 apple$ python

Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> from lxml import etree

Traceback (most recent call last):

File "", line 1, in

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-3.0.1-py2.7-macosx-10.6-intel.egg/lxml/etree.so, 2): Symbol not found: ___xmlStructuredErrorContext

Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-3.0.1-py2.7-macosx-10.6-intel.egg/lxml/etree.so

Expected in: flat namespace

in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-3.0.1-py2.7-macosx-10.6-intel.egg/lxml/etree.so

解决方案

I had the same problem. If you have installed it with pip as follows: pip install lxml

Instead, try to use

STATIC_DEPS=true pip install lxml

This solved the problem for me.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值