aws-codebuild - 如何在 AWS CodeBuild 构建中使用 python boto3?
问题描述
我需要直接从我的 CodeBuild 脚本中发送 SNS 通知,但是我收到了这个错误:
ImportError: No module named boto3
有可能修复吗?还是 CodeBuild 环境限制性太强而不允许这种事情发生?
解决方案
CodeBuild curated images for Python don't have boto3 installed. You could use pip install boto3
to install this module during the build by specifying this command in the buildspec.yml. For example, if your python file is main.py
, you buildspec.yml should look like this:
version: 0.2
phases:
install:
- pip install boto3
- [other install commands if needed]
build:
- python main.py
推荐阅读
- html - 为什么h1和按钮没有对齐
- javascript - 使用 jQuery 或 Javascript 在动态生成的复选框值上显示和隐藏 Div
- typescript - 如何在打字稿中键入键为鉴别器且值由联合组成的对象?
- python - 在python中减去数字的问题
- php - 将数据传递给 Laravel 通知构造函数时出现奇怪的错误
- python - 如何在 python 中加速切片,而不是使用 for 循环
- ios - 未定义的符号:___ isplatformversionatleast
- python - 使用 plotly 的折线图
- python-3.x - 我正在编写一个脚本来抓取网站并下载文件。下载后,我试图重命名文件,但它不工作
- jquery - 如何通过 ajax 请求调用 API