【问题标题】:Python is not configured for aws sam cli没有为 aws sam cli 配置 Python
【发布时间】:2021-03-29 15:38:08
【问题描述】:

我正在按照本教程构建一个 SAM 应用程序:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html

当我执行sam build 时,出现以下错误

❯ sam build
Building codeuri: hello_world/ runtime: python3.8 metadata: {} functions: ['HelloWorldFunction']

Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations  : ['/usr/bin/python'] which did not satisfy constraints for runtime: python3.8. Do you have python for runtime: python3.8 on your PATH?

我通过这样做检查了我的 python

❯ which python
python: aliased to python3

当我做 python 版本时,我得到了这个

❯ python --version
Python 3.8.2

那么我缺少什么以及如何解决这个问题?

【问题讨论】:

  • 一些想法 here 检查你的 template.yaml 中的运行时并考虑重新安装 awscli 和 sam
  • 已经验证了python版本。现在正在卸载所有 pythons/aws-cli 和 sam cli
  • @EmAe 如果这解决了您的问题,请写下您自己问题的答案并接受它。这是允许的。请参阅帮助中心"Can I answer my own question?"

标签: python amazon-web-services aws-lambda serverless aws-sam


【解决方案1】:
python3 --version

找到解决方案。 您可能选择了 python3.8/python3.7 作为应用程序的运行时。当系统的 python 版本不匹配时会发生错误。 检查 python 版本:python3 --version 并使用与系统 python 版本相同的应用运行时。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,但是在类路径中设置 python 3.8 后问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-24
      • 2019-02-27
      • 2020-08-30
      • 1970-01-01
      • 2019-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多