我尝试在OS X 10.6.8上安装lxml:
sudo python setup.py build --static-deps
sudo python setup.py install
安装正常,没有任何错误。当我进入Python REPL时,我得到以下内容:
Nabs$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 14:13:39)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
>>> import lxml.html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.3-fat.egg/lxml/html/__init__.py", line 12, in <module>
from lxml import etree
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.3-fat.egg/lxml/etree.so, 2): Symbol not found: _xsltLibxsltVersion
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.3-fat.egg/lxml/etree.so
Expected in: dynamic lookup