我正在尝试在虚拟机上的Ubuntu上安装libxml2-2.9.1。 我按照以下链接中的步骤进行操作: http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html http://www.geeksww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php#comment
我在编译步骤后陷入困境。当我按照任何一个链接时,我会遇到同样的错误。错误是
make[3]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/doc/examples'
make[2]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/doc'
Making all in example
make[2]: Entering directory `/home/abhijit/Documents/libxml2-2.9.1/example'
CC gjobread.o
CCLD gjobread
make[2]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/example'
Making all in xstc
make[2]: Entering directory `/home/abhijit/Documents/libxml2-2.9.1/xstc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/xstc'
Making all in python
make[2]: Entering directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make all-recursive
make[3]: Entering directory `/home/abhijit/Documents/libxml2-2.9.1/python'
Making all in .
make[4]: Entering directory `/home/abhijit/Documents/libxml2-2.9.1/python'
CC libxml.lo
libxml.c:14: fatal error: Python.h: No such file or directory
compilation terminated.
make[4]: *** [libxml.lo] Error 1
make[4]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1'
make: *** [all] Error 2
请帮忙。
答案 0 :(得分:6)
你需要python标头。既然你在Ubuntu上,你可能会避免编译python。尝试
$ sudo apt-get install python-dev
然后编译libxml2。
或者,您发布的LFS链接指向编译python的说明。
答案 1 :(得分:2)
嗨我也遇到了这个问题。即使安装了python-dev软件包,我也将所有头文件复制到libxml2库中的python文件夹。
cp /usr/include/python2.7/*.h .... / libxml2-2.9.1 / python /
这解决了我的问题。
答案 2 :(得分:1)
如果您不需要Python绑定,请使用
配置libxml2./configure --without-python
并且您不必安装Python dev包。