ImportError: cannot import name certificate_transparency after installing Pusher

ImportError: cannot import name certificate_transparency after installing Pusher

我用 virtualenv env 创建了一个 virtualenv,然后(在采购 env/bin/activate 之后)用 pip 安装了 pusher。但是,每当我尝试 运行 我的模块时,我都会收到此错误:

Traceback (most recent call last):
  File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/proc-daemon/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/proc-daemon/supachat/supachat.py", line 31, in <module>
    ssl=True
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/pusher.py", line 52, in __init__
    json_encoder, json_decoder, backend, **backend_options)
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/pusher_client.py", line 34, in __init__
    json_encoder, json_decoder, backend, **backend_options)
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/client.py", line 20, in __init__
    from .requests import RequestsBackend
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/pusher/requests.py", line 17, in <module>
    import urllib3.contrib.pyopenssl
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/home/proc-daemon/supachat/env/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency

所有依赖项安装正确,ls env/lib/python2.7/site-packages/cryptography/x509 显示(以及其他)certificate_transparency.pyc(和.py)。

是否有其他我没有意识到的安装方法pusher

所以,这并没有解释问题,但它解决了问题。

我用错了后端。导入 pusher.gae 并设置 backend=pusher.gae.GAEBackend 解决了问题。