[英]AWS Lambda Importing psycopg2 - Unable to import module 'app': No module named 'psycopg2._psycopg
I am trying to use the psycopg2 library with AWS lambda in my Pycharm IDE on Windows 10.我正在尝试在我的 Pycharm Windows 10 上的 lambda IDE 中使用 psycopg2 库。
I have tried all versions of Python listed in this repository and I still always get the following error:我已经尝试了这个存储库中列出的 Python 的所有版本,但我仍然总是收到以下错误:
{"errorMessage": "Unable to import module 'app': No module named 'psycopg2._psycopg'", "errorType": "Runtime.ImportModuleError", "stackTrace": []}
I have tried this solution where we install aws-psycopg2
but it did not work.我已经在安装
aws-psycopg2
地方尝试过这个解决方案,但它没有用。 As per this solution, I have ensured that my local Python runtime and the Lambda runtime are the same and I still get the error.根据此解决方案,我已确保我的本地 Python 运行时和 Lambda 运行时相同,但我仍然收到错误。
I have made sure that my Python version is 64 bit as per this answer根据此答案,我已确保我的 Python 版本为 64 位
Hey incase it still didn't work, i faced the same issue here's what i did:嘿,万一它仍然不起作用,我遇到了同样的问题,这就是我所做的:
pip install --platform=manylinux1_x86_64 --only-binary=:all: psycopg2-binary --target psycopg-binary/python/lib/python3.8/site-packages
pip 安装 --platform=manylinux1_x86_64 --only-binary=:all: psycopg2-binary --target psycopg-binary/python/lib/python3.8/site-packages
hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.