我正在 PyCharm 上开发 AWS Lambda 函数。当我执行“运行”按钮时,出现以下错误消息。
/usr/local/bin/sam build MyFunction --template /Users/miyashiiii/Works/myapp/myapp/template.yaml --build-dir /Users/miyashiiii/Works/myapp/myapp/.aws-sam/build
Building codeuri: myapp/ runtime: python3.7 metadata: {} functions: ['MyFunction']
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.7. Do you have python for runtime: python3.7 on your PATH?
python3.7 在我的 PATH 上,其他一些位置在我的 PATH 上,但位置列表仅包含“/usr/bin/python”。
当我在终端上执行相同的命令(/usr/local/bin/sam build ~~)时,它成功了。
如何将 PATH 导出到“sam build”命令?