我已经认识到ElementTree不会做我想做的事情。我已经检查了lxml的文档,看起来它将用于我的目的。为了获得lxml,我需要获得easy_install。所以我从here下载它,并把它放在/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
。然后我去了那个文件夹,跑了sh setuptools-0.6c11-py2.6.egg
。安装easy_install ...以安装lxml
安装成功。然后我兴奋起来,因为我认为easy_install的重点是我可以通过easy_install lxml进行安装,并且lxml会神奇地下载,构建并正确安装,为导入享受做好准备。所以我跑了easy_install lxml
。我粘贴下面的结果。我该怎么办?
easy_install lxml
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.6
Downloading http://codespeak.net/lxml/lxml-2.2.6.tgz
Processing lxml-2.2.6.tgz
Running lxml-2.2.6/setup.py -q bdist_egg --dist-dir /var/folders/49/49N0+g5QFKCm51AbzMtghE+++TI/-Tmp-/easy_install-rxbP6K/lxml-2.2.6/egg-dist-tmp-fjakR0
Building lxml version 2.2.6.
NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available.
Using build configuration of libxslt 1.1.12
Building against libxml2/libxslt in the following directory: /usr/lib
unable to execute gcc-4.0: No such file or directory
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1
(回复:您的代码编辑器问题)缩进四个空格来创建代码块,或者在突出显示某些内容时单击编辑器中的“01010”按钮。 – 2010-03-03 00:33:38