Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x aws lambda python异常_Python 3.x_Amazon Web Services_Sqlalchemy_Aws Lambda - Fatal编程技术网

Python 3.x aws lambda python异常

Python 3.x aws lambda python异常,python-3.x,amazon-web-services,sqlalchemy,aws-lambda,Python 3.x,Amazon Web Services,Sqlalchemy,Aws Lambda,我试图在AWS lambda中运行python代码,当我运行测试时,AWS lambda出现异常 我不明白这种例外是什么类型的。这是我第一次 { "errorMessage": "The 'psycopg2>=2.5' distribution was not found and is required by the application", "errorType": "DistributionNotFound", "stackTrace": [ [ "

我试图在AWS lambda中运行python代码,当我运行测试时,AWS lambda出现异常

我不明白这种例外是什么类型的。这是我第一次

 {
  "errorMessage": "The 'psycopg2>=2.5' distribution was not found and is required by the application",
  "errorType": "DistributionNotFound",
  "stackTrace": [
    [
      "/var/task/redshift_test.py",
      22,
      "handler",
      "print_meta_info('test_schema')"
    ],
}
下面是我的python3.6运行代码库列表

.
├── redshift_sqlalchemy
├── sqlalchemy
├── SQLAlchemy-1.2.8.egg-info
├── sqlalchemy_redshift
└── sqlalchemy_redshift-0.7.1.dist-info

>> when I try pip freeze
psycopg2==2.7.5
SQLAlchemy==1.2.8
sqlalchemy-redshift==0.7.1

在AWS中执行Lambda函数时,Psycopg2不是可用的模块。事实上,Lambda在其AMI中不包含任何与PostGreSQL数据库通信的库。为了运行psycopg2库,您需要编译C psycopg2库代码,在python文件中引用它,使用lambda函数压缩它,然后直接将其上载到S3或lambda


幸运的是,互联网上的一些善良的灵魂已经这样做了:)你可以在这里找到他的代码

我只是更新你的问题,似乎安装