我正在学习 python 并尝试构建多个 lambdas 来存储和处理 Spotify 收听历史。我最初编写了一个 lambda,所有依赖项打包在同一个目录中,并使用相对路径导入。一旦创建了使用相同依赖项的类似函数,我就将依赖项从函数中分离出来,并使用 pip3 和 setup.py 构建它们。运行 pip3 list 时,我可以按预期看到包。为了使用本地执行函数sam build && sam local invoke SpotifyPlayHistoryListener --env-vars env.json --event events/event.json并验证成功,我指定了一个我已经构建的层——这行得通!为了避免重建图层和修改我的功能,我希望能够恢复使用 requirements.txt 文件并删除指定的图层。重现问题的步骤:Build local editable package - pip3 install -e .Specify in requirements.txtsam build && sam local invoke SpotifyPlayHistoryListener --env-vars env.json --event events/event.json观察结果:Building resource 'SpotifyPlayHistoryListener'Running PythonPipBuilder:ResolveDependenciesBuild FailedError: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: spotify-client预期结果:构建成功并且函数成功执行。其他环境详细信息:sam build && sam local invoke SpotifyPlayHistoryListener --env-vars env.json --event events/event.json使用层指定依赖项时,我可以在本地执行该函数我创建了以下问题https://github.com/awslabs/aws-lambda-builders/issues/155。我认为这可能是我对 python 和 pip 的理解的问题,因此打开的问题可能不相关。
添加回答
举报
0/150
提交
取消