ImportError:安装Pusher后

时间:2018-10-05 19:18:59

标签: python python-2.7 pusher google-app-engine-python

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

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的其他方法吗?

1 个答案:

答案 0 :(得分:0)

所以,这不能解释问题,但可以解决。

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