我是一个关于 Python 的新手,我在 Mac OS X 10.7 上安装 Scrapy 时遇到了麻烦。我尝试了很多不同的东西,但总而言之,当我运行时:
scrapy startproject tutorial
我有这些错误:
ImportError: dlopen(/Library/Python/2.7/site-packages/lxml/etree.so, 2): Symbol not found: ___xmlStructuredErrorContext
Referenced from: /Library/Python/2.7/site-packages/lxml/etree.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/lxml/etree.so
经过大量谷歌搜索后,我关注了这篇文章并尝试了:
python setup.py build --static-deps --libxml2-version=2.7.8 && pip install lxml
但它告诉我:
RuntimeError: ERROR: Trying to build without Cython, but pre-generated 'src/lxml/lxml.etree.c' is not available (pass --without-cython to ignore this error).
如果我使用该—without-cython
选项运行相同的命令,我会得到:
error: command 'llvm-gcc-4.2' failed with exit status 1
(虽然我已经安装了 XCode 命令行工具)
在此先感谢您的帮助 !
(仅供参考,我正在使用 MacPorts 和 pip install…)