我是个蟒蛇新手,试着自己学习如何使用Scrapy,但我在第一步就失败了。我安装了Scrapy,并遵循了http://doc.scrapy.org/en/latest/intro/tutorial.html上的说明。
当我在终端中输入“刮擦入门项目教程”后,它会返回。
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy", line 3, in <module>
from scrapy.cmdline import execute
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/scrapy/cmdline.py", line 7, in <module>
from scrapy.crawler import CrawlerProcess
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/scrapy/crawler.py", line 3, in <module>
from twisted.internet import reactor, defer
ImportError: No module named twisted.internet然后我去下载扭曲,它需要gcc-4.0,但我找不到它的下载。我的python2.7.3似乎运行在gcc4.0.1上,但我不知道哪里出了问题.下面是我在终端中输入“pip install the”后的最后几行代码(不过,我的pip正在运行):
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c twisted/test/raiser.c -o build/temp.macosx-10.3-intel-2.7/twisted/test/raiser.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/ww/7vcs04j95jg4dgcb94t7s5p00000gn/T/pip-build/twisted/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ww/7vcs04j95jg4dgcb94t7s5p00000gn/T/pip-lfT0hS-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/ww/7vcs04j95jg4dgcb94t7s5p00000gn/T/pip-build/twisted我的Mac运行在MAcOSX 10.7.5上,我从未安装过Xcode。
任何帮助都是非常感谢的!
发布于 2013-04-29 02:56:21
我在OSX上和Scrapy有过这个问题。我用以下方法修正了它:
发布于 2013-02-11 05:01:26
这个问题解决了!以下是那些陷入困境的人的解决办法:
如果您正在使用MacOSX 10.6及更高版本(32 is MacOSX 10.7.5),如果您想使用Scrapy,请检查Python的版本:从官方页面下载“Python2.7.3 MacOSX 64位/32位x86-64/i 386安装程序”,下载正确的ActiveTcl版本,并测试ActiveTcl:它应该使用gcc 4.2.1。
然后,安装pip,然后再安装Scrapy、twisted、zope和任何其他模块Scrapy想要的模块。
(在安装正确版本的Python之前,我实际上已经安装了gcc4.2.1。因此,如果上面的解决方案不够,请尝试安装gcc4.2.1)
计算机Pros @ Kalamazoo学院学分!
https://stackoverflow.com/questions/14680455
复制相似问题