(still) cannot properly install lxml 2.3 for python, but at least 2.2.8 works

帅比萌擦擦* 提交于 2019-11-30 14:36:26

Your libxslt do not have exsltMathXpathCtxtRegister remove it, and manually install a newer version (1.1.26 should work fine).

An older version of lxml may work too, try with easy_install lxml==2.2.8

A word to future googlers - I arrived here with the same symptom, but a sufficiently recent packaged version of libxslt installed (1.1.26). Took about 10 minutes before I realised I also had an ancient version in my path, (installed with the casapy astronomy package).

Moral of the story: run a locate libxslt to find old versions, and check against your $LD_LIBRARY_PATH! (Of course, this applies to any library conflict in general).

Reading your output it looks like the linker output an error: undefined reference to gzopen64

That error bubbled up into lxml-2.3/buildlibxml.py", line 236, in call_subprocess, which bubbled up again into make -j6

I found a thread here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=15524 that had the same compiler error. With a suggestion

You may the i586 version of the zlib delegate library installed. You may need to install the 64-bit version of zlib and zlib-devel.

And the OP of that thread later commented:

What i did now is downloading the source from zlib and compiled it into local environment. /usr/local/includes and such. recompiled all plugins and compiled ImageMagick again.

Now it works. Many thanks :D

So, I'd suggest re-installing zlib and zlib-devel, and then try to install lxml again.

You best best may be compiling LibXML2 and LibXSLT from sources. Assuming the prefix for your installation should be the same as your custom Python, which appears to be /usr/local, here's how (there may be newer version of the software so, check that first):

wget http://xmlsoft.org/sources/libxml2-sources-2.7.7.tar.gz
gzip -dc libxml2-sources-2.7.7.tar.gz | tar xvf -
cd libxml2-2.7.7
./configure --prefix=/usr/local
make
make install
wget http://xmlsoft.org/sources/libxslt-1.1.26.tar.gz
gzip -dc libxslt-1.1.26.tar.gz | tar xvf -
cd libxslt-1.1.26
./configure --prefix=/usr/local
make
make install

If the above does not compile, there may be other dependencies that you should try to satisfy from yum packages, typically these would be certain libraries and/or *-devel packages with missing header files.

Once that's done either

easy_install lxml

or

pip install lxml

Make sure you have libxslt-dev and libxml2-dev installed on your machine (you can do this with yum I guess); lxml won't build without them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!