Python 2.7
和CentOS 7
中不能导入libxml2
和libxslt
但是系统说这些包已经安装:
Package libxml2-2.9.1-5.el7_1.2.x86_64 already installed and latest version
Package libxml2-devel-2.9.1-5.el7_1.2.x86_64 already installed and latest version
Package libxslt-1.1.28-5.el7.x86_64 already installed and latest version
Package libxslt-devel-1.1.28-5.el7.x86_64 already installed and latest version
但不能在Python2.7中导入
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libxml2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named libxml2
>>> import libxslt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named libxslt
>>>
libxml2 install step
yum groupinstall "Development Tools"
yum install python-devel.x86_64
rpmbuild -ba /usr/src/redhat/SPECS/libxml2.spec (this might not be required.)
##go to RPMS/x86_64/
rpm -Uvh libxml2-python-2.7.8-1.x86_64.rpm --nodeps
===================================================================
libxslt install stepwget http://xmlsoft.org/sources/libxslt-1.1.28.tar.gz
cd libxslt-1.1.28
./configure --with-python=/usr/bin/python2.7
make
make install
========================================