ubuntu 11.04 lxml导入etree问题为自定义python

前端之家收集整理的这篇文章主要介绍了ubuntu 11.04 lxml导入etree问题为自定义python前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
ubuntu 11.04具有本机 python2.7,我从源代码生成python2.5到/usr/local/python2.5/bin,并尝试为我的自定义python2.5安装安装lxml.另外我使用virtualenv.我用python2.5切换到我的env.在导入lxml我有一个错误.
from lxml import etree
ImportError: /home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/lxml-2.2.4-py2.5-linux-i686.egg/lxml/etree.so: undefined symbol: PyUnicodeUCS2_DecodeLatin1

使用python2.7 env,一切都可以,但在python2.5导入失败.请帮忙解决python2.5?

ldd /home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/lxml-2.2.4-py2.5-linux-i686.egg/lxml/etree.so

结果:

(e-py25)se7en@se7en-R510-P510:~/downloads/lxml-2.2.4$ldd /home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/lxml-2.2.4-py2.5-linux-i686.egg/lxml/etree.so
    linux-gate.so.1 =>  (0x00968000)
    libxslt.so.1 => /usr/lib/libxslt.so.1 (0x005aa000)
    libexslt.so.0 => /usr/lib/libexslt.so.0 (0x00110000)
    libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00db3000)
    libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0x00a22000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x00564000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00123000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x0013c000)
    libgcrypt.so.11 => /lib/i386-linux-gnu/libgcrypt.so.11 (0x0029d000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x00d6e000)
    /lib/ld-linux.so.2 (0x004fc000)
    libgpg-error.so.0 => /lib/i386-linux-gnu/libgpg-error.so.0 (0x00879000)
(e-py25)se7en@se7en-R510-P510:~/downloads/lxml-2.2.4$
这个问题通常是通过构建Python而不使用./configure命令上的–enable-unicode = ucs4选项引起的.

要确保正确的做法,请删除现有的Python构建目录,然后通过解压缩Python压缩包重新开始构建.

此外,删除现有的Python 2.5安装目录/usr/local/python2.5/,并重新构建您所建立的其他所有内容,例如lxml.使用编译的组件的任何扩展将查找Python构建配置,因此如果不重建所有将不匹配的部分.

原文链接:https://www.f2er.com/ubuntu/347292.html

猜你在找的Ubuntu相关文章