简体   繁体   中英

No module named pymysql - aws serverless framework

I deployed a python lambda function through server less framework. Installed pymysql through pip . My handler info is : dynamodbtoauroradb/aurora-data-management/aurora-data-management.handler

在此处输入图片说明

I get this error: Unable to import module 'dynamodbtoauroradb/aurora-data-management/aurora-data-management': No module named 'pymysql'

Not sure where the mistake is.

Use the plugin serverless-python-requirements with docker.

This will package all your python virtual env dependencies into your serverless package.

See this answer for more details

There is a chance that pymysql is there in your system packages. So when you built the virtualenvironment, it used the system package.

Create a clean virtualenv using

virtualenv --no-site-packages envname

Or else you can use the current one, with

pip install pymysql --no-deps --ignore-installed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM