Python 使用pip安装lxml模块失败

Python 使用pip安装lxml模块失败,python,ubuntu,pip,lxml,Python,Ubuntu,Pip,Lxml,在以前的堆栈溢出问题中已经报告了这个错误,但是我在以前的问题中尝试了所有的方法,但是它不起作用 我在Enthoude Corporation中运行Ubuntu14.04LTS和Python2.7 在尝试pip安装lxml或easy_安装lxml后,我的错误如下: fatal error: libxml/xmlversion.h: No such file or directory #include "libxml/xmlversion.h"

在以前的堆栈溢出问题中已经报告了这个错误,但是我在以前的问题中尝试了所有的方法,但是它不起作用

我在Enthoude Corporation中运行Ubuntu14.04LTS和Python2.7

在尝试pip安装lxml或easy_安装lxml后,我的错误如下:

fatal error: libxml/xmlversion.h: No such file or directory  #include
"libxml/xmlversion.h"
                            ^ compilation terminated. error: Setup script exited with error: command 'gcc' failed with exit status 1
根据以前的解决方案,我应该跑步

sudo apt-get install libxslt1-dev
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
我已经运行了所有这些。它们都显示为已安装


我还可以尝试什么?

我使用的是debian,不是ubuntu,而是基本库,应该是相同的:

 % dpkg -S /usr/include/libxml2/libxml/xmlversion.h
libxml2-dev: /usr/include/libxml2/libxml/xmlversion.h
所以它肯定在libxml2-dev中。不过,当您进行pip安装时,您的路径中是否有xml2配置实用程序?下面的返回值是否相同

 % xml2-config --cflags
-I/usr/include/libxml2
好吧,这样就行了:

 $ xml2-config --cflags
-I/usr/include/libxml2
现在,你能做到:

 % ls -l /usr/include/libxml2/libxml/xmlversion.h || ls -l /usr/include/libxml2/libxml/
-rw-r--r-- 1 root root 7747 Oct 13  2013 /usr/include/libxml2/libxml/xmlversion.h
如果缺少目录或文件,则可能需要重新安装libxml2 dev:


这是你问的吗?gronke@nomad:~/Downloads$%xml2 config-cflags bash:fg:%:没有这样的作业gronke@nomad:~/Downloads$-I/usr/include/libxml2 bash:-I/usr/include/libxml2:没有这样的文件或目录提示:—它说它在那里,抱歉,这不是编译问题的解决方案,但是您可以安装python-lxml和/或python3-lxml。如果您仍然想编译它,您可以尝试pip install-v lxml并将失败安装的日志粘贴到某个粘贴器上吗?
 # apt-get install --reinstall libxml2-dev