简体   繁体   English

AWS Lambda 导入错误:无法导入模块“lambda_function”:没有名为“confluent_kafka.cimpl”的模块

[英]AWS Lambda importError: Unable to import module 'lambda_function': No module named 'confluent_kafka.cimpl

I am trying to use confluent_kafka in my AWS Lambda function and I am adding a layer to it.我正在尝试在我的 AWS Lambda function 中使用 confluent_kafka 并向其添加一层。 The layer has a.zip file which contains following packages:该层有一个 .zip 文件,其中包含以下包:

  • confluent_kafka汇流卡夫卡
  • confluent_kafka_1.8.2.dist-info confluent_kafka_1.8.2.dist-信息
  • confluent_kafka.libs confluent_kafka.libs

Note: All the above folders were created in the venv of pycharm when I ran the following command: pip install confluent_kafka, in the pycharm terminal.注意:以上所有文件夹都是在我运行以下命令时在pycharm的venv中创建的:pip install confluent_kafka,在pycharm终端。

I am getting an error:我收到一个错误:

{ "errorMessage": "Unable to import module 'lambda_function': No module named 'confluent_kafka.cimpl'", "errorType": "Runtime.ImportModuleError", "requestId": "3531b1f4-36b8-495a-a51f-f0e3105700b8", "stackTrace": [] } { “errorMessage”:“无法导入模块‘lambda_function’:没有名为‘confluent_kafka.cimpl’的模块”,“errorType”:“Runtime.ImportModuleError”,“requestId”:“3531b1f4-36b8-495a-a51f-f0e3105700b8”, “堆栈跟踪”: [] }

Please help me with solving this error.请帮我解决这个错误。

You have to zip with only one level of parent.您必须只有一级父级才能拨打 zip。 Try to extract the zip file and see if there are multiple folders(nested).尝试提取 zip 文件并查看是否有多个文件夹(嵌套)。 for example if "layers" is your folder name then when you extract the zip file you should see the "layers" folder and all other libraries inside it and not another "layers" folder or so.例如,如果“layers”是您的文件夹名称,那么当您提取 zip 文件时,您应该看到“layers”文件夹和其中的所有其他库,而不是另一个“layers”文件夹。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法导入模块“lambda_function”:没有名为“psycopg2._psycopg aws lambda 函数”的模块 - Unable to import module 'lambda_function': No module named 'psycopg2._psycopg aws lambda function AWS Lambda 层无法导入模块“lambda_function”:没有名为“pyarrow.lib”的模块 - AWS Lambda Layer Unable to import module 'lambda_function': No module named 'pyarrow.lib' aws lambda 无法导入模块“lambda_function”:没有名为“requests”的模块 - aws lambda Unable to import module 'lambda_function': No module named 'requests' 无法导入模块“lambda_function”:没有名为“pymongo”的模块 - Unable to import module 'lambda_function': No module named 'pymongo' AWS Lambda - 无法导入模块“lambda_function” - AWS Lambda - unable to import module 'lambda_function' 无法导入模块“lambda_function”:没有名为“aws_xray_sdk”的模块 - Unable to import module 'lambda_function': No module named 'aws_xray_sdk' 无法导入模块“lambda_function”: - Unable to import module 'lambda_function': 无法导入模块“lambda_function”:没有名为“flatten_json”的模块 - Unable to import module 'lambda_function': No module named 'flatten_json' 无法导入模块“lambda_function”:没有名为“orjson.orjson”的模块”, - Unable to import module 'lambda_function': No module named 'orjson.orjson'", AWS Lambda Opencv(“无法导入模块‘lambda_function’:libgthread-2.0.so.0:无法打开共享对象文件:没有这样的文件或目录”) - AWS Lambda Opencv ("Unable to import module 'lambda_function': libgthread-2.0.so.0: cannot open shared object file: No such file or directory")
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM