无法导入模块' lambda_function':没有名为' psycopg2._psycopg的模块
我尝试使用Amazon RDS Postgres数据库调用Lambda功能。当我尝试运行lambda函数时,我遇到了这个错误:
{
"errorMessage": "Unable to import module 'lambda_function': No module named'psycopg2._psycopg'",
"errorType": "Runtime.ImportModuleError",
"requestId": "c1c7e814-9560-4d5e-a71d-fa39fc33132e",
"stackTrace": []
}
我已经添加 psycopy2--二进制
包装。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
逐线键入以下代码中的代码。可以用您选择的包装替换PIP安装pandas命令。您也可以安装超过1个软件包*。
然后按行键入以下代码以创建您的图层
请参阅下面的链接以获取Postgres层: -
=“ https://i.sstatic.net/2psaa.png” alt =“在此处输入图像说明”>
转到AWS lambda函数 - >创建图层
Type the following code line by line into the terminal at the bottom. The pip install pandas command can be replaced with a package of your choosing. You can also install more than 1 package*.
Then type the following code line by line to create your layer
Please refer below link for postgres layer:-
https://towardsdatascience.com/python-packages-in-aws-lambda-made-easy-8fbc78520e30
Go to AWS Lambda function -> create layer
