在GitHub上发布的交叉帖子。
我正在使用AWS Amplify和pipenv为我的Python 3.9 Lambda工作。我尝试使用pandas创建数据帧,进行一些处理,并将其写回CSV以供Sagemaker推理使用。
重现代码示例:
import pandas as pd
在这之后,代码立即失败。
错误信息:
以下是完整的错误信息:
[ERROR] Runtime.ImportModuleError: Unable to import module 'index':
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/var/lang/bin/python3.9"
* The NumPy version is: "1.21.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
我最初使用 pipenv install pandas
下载,这会自动安装numpy。
为了解决问题,我尝试了以下方法:
pipenv install numpy / pipenv uninstall numpy
pipenv uninstall pandas / pipenv install pandas
pipenv uninstall setuptools / pipenv install setuptools
需要注意的是,我使用的是Windows 10操作系统。