无法导入 pyrebase GAE

Cannot import pyrebase GAE

我有一个可以在本地完美运行的应用程序。但是,出于某种原因,在 GAE(标准 python37)中导入 pyrebase 似乎有问题(requirements.txt 中的 pyrebase==3.0.27)。知道如何解决这个问题吗?

提前致谢!

Traceback (most recent call last):
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/workspace/main.py", line 8, in <module>
    import pyrebase
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pyrebase/__init__.py", line 1, in <module>
    from .pyrebase import initialize_app
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pyrebase/pyrebase.py", line 17, in <module>
    from oauth2client.service_account import ServiceAccountCredentials
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/oauth2client/service_account.py", line 25, in <module>
    from oauth2client import client
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/oauth2client/client.py", line 47, in <module>
    from oauth2client import crypt
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/oauth2client/crypt.py", line 55, in <module>
    from oauth2client import _pycrypto_crypt
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/oauth2client/_pycrypto_crypt.py", line 17, in <module>
    from Crypto.PublicKey import RSA
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/Crypto/PublicKey/__init__.py", line 29, in <module>
    from Crypto.Util.asn1 import (DerSequence, DerInteger, DerBitString,
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/Crypto/Util/asn1.py", line 33, in <module>
    from Crypto.Util.number import long_to_bytes, bytes_to_long
  File "/layers/google.python.pip/pip/lib/python3.7/site-packages/Crypto/Util/number.py", line 398
    s = pack('>I', n & 0xffffffffL) + s

SyntaxError: invalid syntax

Pyrebase 3.0.27 与 Python 版本 3 存在兼容性问题。请改用最新版本的 PyrebasePyrebase4.

OP 通过更改 requirements.txt 中的 Pyrebase 版本解决了问题:

From pyrebase==3.0.27 to Pyrebase4==4.5.0