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