Python 使用AWS lambda的JWT文件出错

Python 使用AWS lambda的JWT文件出错,python,python-2.7,jwt,aws-lambda,Python,Python 2.7,Jwt,Aws Lambda,我在python JWT包上有一个错误,它过去对我来说工作正常,但我知道我有这个问题: START RequestId: b7364861-32ef-11e7-95fd-194d4089f11f Version: $LATEST Syntax error in module 'lambda_function': invalid syntax (jwk.py, line 60) END RequestId: b7364861-32ef-11e7-95fd-194d4089f11f REPORT

我在python JWT包上有一个错误,它过去对我来说工作正常,但我知道我有这个问题:

START RequestId: b7364861-32ef-11e7-95fd-194d4089f11f Version: $LATEST
Syntax error in module 'lambda_function': invalid syntax (jwk.py, line 60)

END RequestId: b7364861-32ef-11e7-95fd-194d4089f11f
REPORT RequestId: b7364861-32ef-11e7-95fd-194d4089f11f  Duration: 0.28 ms   Billed Duration: 100 ms     Memory Size: 256 MB Max Memory Used: 18 MB
py是JWT包的一部分,而不是我的代码的一部分:

Line 60 is:

    def is_sign_key(self) -> bool:

From:

class AbstractJWKBase:
def get_kty(self):
 raise NotImplementedError() # pragma: no cover
def get_kid(self):
 raise NotImplementedError() # pragma: no cover
def is_sign_key(self) -> bool:
 raise NotImplementedError() # pragma: no cover
def sign(self, message: bytes, **options) -> bytes:
 raise NotImplementedError() # pragma: no cover
def verify(self, message: bytes, signature: bytes, **options) -> bool:
 raise NotImplementedError() # pragma: no cover
def to_dict(self, public_only=True):
 raise NotImplementedError() # pragma: no cover
@classmethod
 def from_dict(cls, dct):
 raise NotImplementedError() # pragma: no cover
我真的不知道怎么了?我在安装包时使用了python2作为环境,所以我认为这不是版本问题,但不能肯定


在使用Python 2时,JWT需要Python 3


建议您改用PyJWT

这是python3语法,脚本是否以python2运行?@jordanm我想这就是问题所在(在2环境中运行3个代码)。不过,我正在使用Python2虚拟环境进行安装。所以我不确定问题是我还是他们。检查这个