我有以下Lambda函数:
import pandas as pd
def lambda_handler(events, context):
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
print(df)
我有熊猫(和依赖项)作为一个层包括在内。我可以在文件中看到numpy和其他依赖项(以及其他文件和文件夹):
python/lib/python3.11/site-packages/numpy
python/lib/python3.11/site-packages/numpy-1.26.4.dist-info
当我运行该函数时,我会得到以下错误:
{
"errorMessage": "Unable to import module 'lambda_function': Unable to import required dependencies:\nnumpy: Error importing numpy: you should not try to import numpy from\n its source directory; please exit the numpy source tree, and relaunch\n your python interpreter from there.",
"errorType": "Runtime.ImportModuleError",
"requestId": "ebf17462-e3c2-40c0-9a44-a751882ab7d8",
"stackTrace": []
}
知道我为什么会犯这个错误吗?