Checkov error: AttributeError: type object 'Lark' has no attribute '_load_from_dict

Checkov error: AttributeError: type object 'Lark' has no attribute '_load_from_dict

我有一些问题 运行 checkov,我不熟悉 python 库,谁能给我一些提示?

这在某些机器上工作正常,但在这台机器上效果不佳...

运行 在 CentOS 中:

$ checkov --directory cdk.out

Traceback (most recent call last):
  File "/usr/local/bin/checkov", line 2, in <module>
    from checkov.main import run
  File "/usr/local/lib/python3.6/site-packages/checkov/main.py", line 22, in <module>
    from checkov.terraform.plan_runner import Runner as tf_plan_runner
  File "/usr/local/lib/python3.6/site-packages/checkov/terraform/plan_runner.py", line 11, in <module>
    from checkov.terraform.context_parsers.registry import parser_registry
  File "/usr/local/lib/python3.6/site-packages/checkov/terraform/context_parsers/__init__.py", line 1, in <module>
    from checkov.terraform.context_parsers.parsers import *
  File "/usr/local/lib/python3.6/site-packages/checkov/terraform/context_parsers/parsers/provider_context_parser.py", line 1, in <module>
    import hcl2
  File "/usr/local/lib/python3.6/site-packages/hcl2/__init__.py", line 5, in <module>
    from .api import load, loads
  File "/usr/local/lib/python3.6/site-packages/hcl2/api.py", line 4, in <module>
    from hcl2.parser import hcl2
  File "/usr/local/lib/python3.6/site-packages/hcl2/parser.py", line 53, in <module>
    hcl2 = Lark_StandAlone(transformer=DictTransformer())
  File "/usr/local/lib/python3.6/site-packages/hcl2/lark_parser.py", line 8, in Lark_StandAlone
    return Lark._load_from_dict(DATA, MEMO, **kwargs)
AttributeError: type object 'Lark' has no attribute '_load_from_dict'

将 python 从 3.6 升级到 3.8 并重新安装 checkov 后,它工作得很好。