【问题标题】:error occurs when installing cryptography for scrapy in virtualenv on OS X [closed]在 OS X 上的 virtualenv 中为 scrapy 安装加密时发生错误 [关闭]
【发布时间】:2016-07-12 22:39:48
【问题描述】:

我在OS X 10.11 上的virtualenv 中使用pip 安装scrapy。在安装密码学时,它说:

building '_openssl' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c build/temp.macosx-10.11-intel-2.7/_openssl.c -o build/temp.macosx-10.11-intel-2.7/build/temp.macosx-10.11-intel-2.7/_openssl.o
build/temp.macosx-10.11-intel-2.7/_openssl.c:423:10: fatal error: 'openssl/e_os2.h' file not found
#include <openssl/e_os2.h>
     ^
1 error generated.
error: command 'cc' failed with exit status 1

Command "/Users/Kris/Workspace/env/scrapy/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/wx/jm7lxhps3n7484zl4gv9s3180000gn/T/pip-build-2rJYgI/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/wx/jm7lxhps3n7484zl4gv9s3180000gn/T/pip-nXp2mE-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Kris/Workspace/env/scrapy/include/site/python2.7/cryptography" failed with error code 1 in /private/var/folders/wx/jm7lxhps3n7484zl4gv9s3180000gn/T/pip-build-2rJYgI/cryptography

有什么建议可以帮助我解决这个问题吗?
顺便说一句,当我在没有 virtualenv 的情况下安装 scrapy 时,一切都很顺利。

【问题讨论】:

  • 嗯,你确定所有的依赖(尤其是 SSL 相关的)都安装了吗?
  • 如果你正在运行自制软件, brew install openssl && env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/包括“pip install cryptography - 见cryptography.io/en/latest/installation/…

标签: python macos cryptography scrapy cc


【解决方案1】:
pip install --upgrade pip

可能有帮助

【讨论】:

  • 或者下一行也适用于我:brew install openssl &amp;&amp; brew link openssl --force
  • @madzohan 它有效。
猜你喜欢
  • 1970-01-01
  • 2014-12-14
  • 2017-04-05
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-28
  • 1970-01-01
相关资源
最近更新 更多