2016-05-24 160 views
4

我試圖在El Capitan上安裝Scrapy,但還沒有成功。這發生在我使用pip install Scrapy在OS X上安裝Scrapy El Capitan

#include <openssl/opensslv.h> 

     ^

1 error generated. 

error: command 'cc' failed with exit status 1 

---------------------------------------- 
Cleaning up... 
Command /<scrapy_project>/venv/bin/python -c "import setuptools, tokenize;__file__='/<scrapy_project>/venv/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/p6/jvf54l7d5c7dntzm6d3rfc3w0000gn/T/pip-D2QIZq-record/install-record.txt --single-version-externally-managed --compile --install-headers /<scrapy_project>/venv/include/site/python2.7 failed with error code 1 in /<scrapy_project>/venv/build/cryptography 

我的Xcode和Xcode的命令工具是最新的。 我試着用和沒有辦法通過自制根據http://doc.scrapy.org/en/latest/intro/install.html#intro-install

編輯安裝Scrapy:我做了以下內容:

根據
  • brew install openssl && brew link openssl --force到 Craicerjack的建議
  • pip install cryptography
  • pip install scrapy

全部沒有任何電子工作rrors。但是scrapy --version拋出這個錯誤:

ImportError: dlopen(/<scrapy_project>/venv/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _BIO_new_CMS 
    Referenced from: /<scrapy_project>/venv/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so 
    Expected in: flat namespace 
in /<scrapy_project>/venv/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so 
+1

的問題中找到,看起來像是構建密碼包的問題。也許'皮普安裝密碼學'第一?也[這個問題的第二個評論](http://stackoverflow.com/questions/36215447/error-occurs-when-installing-cryptography-for-scrapy-in-virtualenv-on-os-x)可能會有所幫助 – Craicerjack

+0

您錯過了openssl的開發包 –

+0

@Craicerjack感謝您的評論!請參閱我的問題的編輯。 – wildthing

回答

5

這裏的問題是安裝需要Scrapy

依賴的

首先,你應該升級到最新版本PIP的:

pip install --upgrade pip 

如果不起作用,建立加密和動態鏈接它:

brew install openssl 
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography 

關於安裝的更多信息,可以在cryptography docs

其他問題被發現可以通過使用命令

LDFLAGS="-L/usr/local/opt/openssl/lib" pip install cryptography --no-use-wheel 

這不應該是必要的但是,如果所有軟件(最新PIP和密碼),到了亟待解決至今。關於這個問題的更多信息可以在cryptography repo on github

相關問題