简体   繁体   English

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

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

I want to install Scrapy on my macbook OSX 10.9 我想在Macbook OSX 10.9上安装Scrapy

I followed all of the prerequisites listed here: http://doc.scrapy.org/en/latest/intro/install.html 我遵循了此处列出的所有先决条件: http : //doc.scrapy.org/en/latest/intro/install.html

And then typed the following into the terminal: pip install Scrapy 然后在终端中输入以下内容: pip install Scrapy

At the very bottom of the terminal it says: 在终端的最底部说:

2 warnings and 6 errors generated.

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

And then below that it says: 然后在其下方显示:

----------------------------------------
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

I went and looked and there is now a folder on my macbook called "Scrapy" and it contains a zip file called "scrapy-scrapy-0.22.0-7-gcde9a8c.zip" but that's it so I'm assuming that it was not installed successfully? 我去看了一下,在Macbook上现在有一个名为“ Scrapy”的文件夹,它包含一个名为“ scrapy-scrapy-0.22.0-7-gcde9a8c.zip”的zip文件,但是就是这样,所以我假设它是没有成功安装?

Or should I just ignore the errors and warnings and unzip the zip file? 还是应该忽略错误和警告并解压缩zip文件?

Thanks for the help. 谢谢您的帮助。

EDIT: I know for a fact it's not installed because when I try to start a new scrapy project the terminal gives me this output: 编辑:我知道一个事实,它没有安装,因为当我尝试启动一个新的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'

EDIT 2 - Here are the 6 errors that were printed: 编辑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 needs twisted to work and it is trying to compile it but runnning into errors. Scrapy需要扭曲才能工作,它正在尝试对其进行编译,但会遇到错误。 I have found bug tracker for this here . 在这里找到了这个的错误追踪器 That bug is still open as far as I can see, so on Python 3.3 it is not possible to install twisted right now. 据我所知,该错误仍未解决,因此在Python 3.3上无法立即安装twis​​ted。 You might like to try installing it with Python 2.7. 您可能想尝试使用Python 2.7安装它。

Unfortunately, Scrapy doesn't support Python 3 yet - porting is not started because of twisted issues. 不幸的是,Scrapy还不支持Python 3-由于扭曲的问题,移植尚未开始。 Scrapy 0.22 only works with Python 2.7. Scrapy 0.22仅适用于Python 2.7。

To successfully install Scrapy, you need to make sure that you have already installed the tool Twisted. 要成功安装Scrapy,您需要确保已经安装了Twisted工具。

I met the same problem,"error: command '/usr/bin/clang' failed with exit status 1" , when I tried to install Scrapy and Twisted in my mac. 当我尝试在Mac中安装Scrapy和Twisted时,遇到了同样的问题,“错误:命令'/ usr / bin / clang'失败,退出状态为1”。

This problem was fixed after I installed the Xcode. 安装Xcode后,此问题已解决。 I'm not sure if you use MacOS system like me. 我不确定您是否使用像我这样的MacOS系统。 If yes, this may help you. 如果是,这可能对您有帮助。

command line: 命令行:

xcode-select --install

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

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