在x86_64 Cent OS中导入lxml的objectify和etree时出错
我在CentOS上设置了一个环境,里面有virtualenv和python 2.7。我用下面的命令安装了lxml:
CFLAGS="$CFLAGS -fPIC -lgcrypt -ldl -lgpg-error -lrt" STATIC_DEPS=true pip2.7 install lxml
安装过程没有报错,一切看起来都很正常。
但是,当我在程序中导入lxml.objectify时,程序就出问题了。进一步调查后,我发现不仅是lxml.objectify,连lxml.etree也无法导入。我从objectify得到的错误信息是:
>>> from lxml import objectify
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /var/htdocs/plus.dev/env1/lib/python2.7/site-packages/lxml/objectify.so: undefined symbol: lzma_auto_decoder
而从etree得到的错误信息是:
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /var/htdocs/plus.dev/env1/lib/python2.7/site-packages/lxml/etree.so: undefined symbol: lzma_auto_decoder
我在网上查了一下,按照一些论坛的建议卸载了xz-devel,但问题依然存在,这让我很沮丧。
这可能是什么问题呢?
1 个回答
0
我经过很多搜索终于解决了这个问题。这个错误是因为32位和64位的Python包发生了冲突。想要更详细的描述和解决方案,可以在这里查看 https://github.com/0xdata/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-exactly-for-centos-machine-only