我已经认识到 ElementTree 不会做我想做的事情。我已经查看了 lxml 的文档,看来它可以满足我的目的。要获得 lxml,我需要获得 easy_install。所以我从这里下载了它,并把它放进去/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
。然后我去了那个文件夹,然后运行sh setuptools-0.6c11-py2.6.egg
.
即安装成功。然后我很兴奋,因为我认为 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