我是一個關於Python的新手,我在Mac OS X 10.7上安裝Scrapy時遇到問題。我已經嘗試了很多不同的東西,但總的來說,當我運行:如何在Mac OS X 10.7上安裝Scrapy? (lxml錯誤)
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
很多谷歌搜索後,我跟着this post和嘗試:
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安裝...)
謝謝你的幫助。我有'port select --show python':'當前選擇的'python'版本是'none'。' 然後我做了'sudo port select --set python27': '選擇'python27'for'python '成功了。 'python27'現在處於活動狀態。' 現在,我可以開始輸入「sudo /opt/local/bin/scrapy-2.7 startproject教程」。 – bsfoo116