【发布时间】:2016-02-01 11:03:01
【问题描述】:
我是 mac 新手,我不明白为什么我的 scrapy 似乎不再工作了。我怀疑 openssl 在我的 el capitan 中无效。
我试过了:
pip install cryptography
pip install pyOpenSSL
brew install openssl
我仍然收到以下错误。 有什么办法可以解决这个问题吗?
$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _BIO_new_CMS
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so
>>>
【问题讨论】:
-
您使用的是什么版本的 pip?另外,
otool -L /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so的输出是什么。看起来您正在将密码学安装到全局 Python 包中,这通常是一个不明智的选择,但不太可能与此问题相关。编辑:因为它是 /Library 这很可能是 python.org python。尝试卸载加密然后运行env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography -
@PaulKehrer 谢谢,苹果提供的 python 和 python.org python 刚刚混淆了。在理顺了 lib 路径后,它终于起作用了。
-
有道理。如果您使用的是 Apple 提供的 python(或 pyenv),那么当前用于 pyca/cryptography 的轮子将在 10.10+ 上运行,但不适用于 python.org。我们正在努力解决这个限制。
-
这个问题你解决了吗?我现在也有同样的问题。
标签: python macos python-2.7 scrapy osx-elcapitan