我正在寻找如何将 Boto 库包含在 Elastic Beanstalk 实例中。我的印象是我必须在 .ebextensions
中指定它。不幸的是,这似乎不起作用(见下文)。
python.config:
packages:
python:
Flask: []
Boto: []
option_settings:
...AWS key redacted...
代码:
import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key
错误信息:
导入错误:没有名为 boto 的模块
我是否缺少配置文件中的任何内容?我还需要做其他事情吗?
最佳答案
包名boto事实上,它是小写的,所以调整它可能已经解决了你的问题。
或者,您可能想尝试明显推荐的方式 Customizing and Configuring a Python Container通过典型的 requirements.txt
文件和 pip
代替,请参阅 2):
Create a requirements.txt file and place it in the top-level directory of your source bundle. A typical python application will have dependencies on other third-party Python packages. In Python, pip is the standard way of installing packages. Pip has a feature that allows you to specify all the packages you need (as well as their versions) in a single requirements file. For more information about the requirements file, go to Requirements files. The following is an example requirements.txt file for Django.
Django==1.4.1 MySQL-python==1.2.3
因此,就您而言,目前可能是:
Flask==0.9
boto==2.9.2
Deploying a Python Application to AWS Elastic Beanstalk Using the Elastic Beanstalk Console 中也有这样的说明。 .
关于python - 将 Boto 库包含在 Elastic Beanstalk 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16308956/