[英]Install newer version of sqlite3 on AWS Lambda for use with Python
[英]Install newer version of sqlite3 on AWS Lambda
我想在我在 AWS Lambda 上运行的 python3.8 代码的 sqlite3 上使用 Window 函数。 它们从3.25
版本开始可用。
不幸的是,在 AWS Lambda Python3.8 上,sqlite3 库已过时:
>>> sqlite3.sqlite_version
'3.7.17'
在本地,在我的 Python3.8 的自制安装中:(工作)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
如何在 AWS Lambda Python 3.8 上获得 sqlite3 版本 > 3.25?
我找到了一种方法:我在二进制版本中使用了外部 package pysqlite3
。
在我的 requirements.txt
pysqlite3-binary==0.4.4
在代码中
try:
import pysqlite3 as sqlite3
except ModuleNotFoundError:
import sqlite3 # for local testing because pysqlite3-binary couldn't be installed on macos
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.