在Ubuntu 10.04.4上安装lxml的问题

时间:2015-08-13 09:47:20

标签: python python-2.7

我正在尝试在我的Ubuntu 10.04.4上安装“lxml”并收到以下错误:

root@buildxxxx:~# easy_install lxml
install_dir /usr/lib/python2.7/site-packages/
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Best match: lxml 3.4.4
Downloading https://pypi.python.org/packages/source/l/lxml/lxml-    3.4.4.tar.gz#md5=a9a65972afc173ec7a39c585f4eea69c
Processing lxml-3.4.4.tar.gz
Running lxml-3.4.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install- hswCIi/lxml-3.4.4/egg-dist-tmp-D4CPP_
Building lxml version 3.4.4.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
src/lxml/lxml.etree.c:16:20: error: Python.h: No such file or directory
src/lxml/lxml.etree.c:18:6: error: #error Python headers needed to compile C    extensions, please install development version of Python.
error: Setup script exited with error: command 'gcc' failed with exit status 1

我正在使用Python 2.7.3版本,并且已经尝试安装libxml2-dev libxslt1-dev python-dev但我已经在我的系统中安装了这些。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你试过pip吗?通常pip应优先于easy_install:
Why use pip over easy_install?
相应的pip命令为

pip install lxml

另外,您可以尝试:

$ sudo apt-get install python-lxml