sqlite3 error on AWS lambda with Python 3

后端 未结 7 1112
终归单人心
终归单人心 2021-02-01 05:07

I am building a python 3.6 AWS Lambda deploy package and was facing an issue with SQLite.

In my code I am using nltk which has a

7条回答
  •  野性不改
    2021-02-01 05:57

    This is a bit of a hack, but I've gotten this working by dropping the _sqlite3.so file from Python 3.6 on CentOS 7 directly into the root of the project being deployed with Zappa to AWS. This should mean that if you can include _sqlite3.so directly into the root of your ZIP, it should work, so it can be imported by this line in cpython:

    https://github.com/python/cpython/blob/3.6/Lib/sqlite3/dbapi2.py#L27

    Not pretty, but it works. You can find a copy of _sqlite.so here:

    https://github.com/Miserlou/lambda-packages/files/1425358/_sqlite3.so.zip

    Good luck!

提交回复
热议问题