繁体   English   中英

在OSX上使用pip安装Scrapy时出现错误和警告

[英]Errors and Warnings when installing Scrapy with pip on OSX

我想在Macbook OSX 10.9上安装Scrapy

我遵循了此处列出的所有先决条件: http : //doc.scrapy.org/en/latest/intro/install.html

然后在终端中输入以下内容: pip install Scrapy

在终端的最底部说:

2 warnings and 6 errors generated.

error: command '/usr/bin/clang' failed with exit status 1

然后在其下方显示:

----------------------------------------
Cleaning up...
Command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3 -c "import setuptools, tokenize;__file__='/private/var/folders/sj/fs5lzbyd7p37_jdkqw03_q4c0000gn/T/pip_build_johnmosely/Twisted/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sj/fs5lzbyd7p37_jdkqw03_q4c0000gn/T/pip-lkdl1g-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/sj/fs5lzbyd7p37_jdkqw03_q4c0000gn/T/pip_build_johnmosely/Twisted
Storing debug log for failure in /Users/johnmosely/.pip/pip.log

我去看了一下,在Macbook上现在有一个名为“ Scrapy”的文件夹,它包含一个名为“ scrapy-scrapy-0.22.0-7-gcde9a8c.zip”的zip文件,但是就是这样,所以我假设它是没有成功安装?

还是应该忽略错误和警告并解压缩zip文件?

谢谢您的帮助。

编辑:我知道一个事实,它没有安装,因为当我尝试启动一个新的scrapy项目时终端会给我这个输出:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/bin/scrapy", line 3, in <module>
    from scrapy.cmdline import execute
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/scrapy/__init__.py", line 43, in <module>
    from twisted import version as _txv
ImportError: No module named 'twisted'

编辑2-这是打印的6个错误:

^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
twisted/python/sendmsg.c:129:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;
        ^
twisted/python/sendmsg.c:138:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;
        ^
twisted/python/sendmsg.c:145:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;
        ^
twisted/python/sendmsg.c:159:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;
        ^
twisted/python/sendmsg.c:165:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;
        ^
twisted/python/sendmsg.c:170:9: error: non-void function 'initsendmsg' should return a value [-Wreturn-type]
        return;

Scrapy需要扭曲才能工作,它正在尝试对其进行编译,但会遇到错误。 在这里找到了这个的错误追踪器 据我所知,该错误仍未解决,因此在Python 3.3上无法立即安装twis​​ted。 您可能想尝试使用Python 2.7安装它。

不幸的是,Scrapy还不支持Python 3-由于扭曲的问题,移植尚未开始。 Scrapy 0.22仅适用于Python 2.7。

要成功安装Scrapy,您需要确保已经安装了Twisted工具。

当我尝试在Mac中安装Scrapy和Twisted时,遇到了同样的问题,“错误:命令'/ usr / bin / clang'失败,退出状态为1”。

安装Xcode后,此问题已解决。 我不确定您是否使用像我这样的MacOS系统。 如果是,这可能对您有帮助。

命令行:

xcode-select --install

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM