libxml2 libxml2dom安装

来源:互联网 发布:java项目https 编辑:程序博客网 时间:2024/05/18 00:33

wget -c ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
tar -xvf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure
make && make install
cd python/  这里需要是小写
CFLAGS=-I/usr/local/include/libxml2 python setup.py install

wget -c http://www.boddie.org.uk/python/downloads/libxml2dom-0.5.tar.bz2
tar -xvf libxml2dom-0.5.tar.bz2
cd libxml2dom-0.5
python setup.py install
cd ../

安装之后,可以

>>> import libxml2mod
>>> 
>>> import libxml2dom

注意需要删除通过yum 等安装的。不然冲突。不能用 easy_install安装11

rpm -e libxml2-devel-2.6.26-2.1.15.el5_8.6 --allmatches  --nodeps


如果不小心删除了libxml2,报ImportError: libxml2.so.2: cannot open shared object file: No such file or directory错误,则需要

[root@test20 lib64]# cp /usr/local/lib/libxml2.so.2 /usr/lib64/


如果报 libxml2mod.so: undefined symbol: xmlTextReaderSetup 错误,检查一下 

ldd /usr/local/lib/python2.7/site-packages/libxml2mod.so

如果链接到的是 /usr/lib64/libxml2.so.2,则可能需要cp /usr/local/lib/libxml2.so.2 /usr/lib64/,重新编译之后,再移回来就可以了



 .libs/xmllint xmllint.o  ./.libs/libxml2.so -ldl -lz -lm

./.libs/libxml2.so: undefined reference to `gzopen64'

collect2: ld returned 1 exit status

make[2]: *** [xmllint] 错误 1

make[2]: Leaving directory `/root/hy/libxml2-2.7.8'

make[1]: *** [all-recursive] 错误 1

make[1]: Leaving directory `/root/hy/libxml2-2.7.8'


如果报以上错误,

./configure --without-zlib

原创粉丝点击