【发布时间】:2020-10-26 09:53:13
【问题描述】:
我有一个 Django 应用程序,它部署到 Elastic Beanstalk、Amazon Linux 2 AMI,而且我对 AWS 非常陌生。我必须在我的应用程序中使用 pythonocc-core 包,我无法通过 pip 安装它。如果我通过 SSH 连接到一个实例并手动安装它,由于 EB 环境的自动缩放,这不是一个好方法。我在下面添加了 .config 文件来安装 anaconda,我的部署成功了。
commands:
00_download_conda:
command: 'wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh'
test: test ! -d /anaconda
01_install_conda:
command: 'bash Anaconda3-2020.02-Linux-x86_64.sh -b -f -p /anaconda'
test: test ! -d /anaconda
02_create_home:
command: 'mkdir -p /home/wsgi'
当我将以下命令行添加到此 .config 文件的延续时,部署失败。
commands:
03_conda_create:
command: conda create --name=whatever-name python=3.7
04_conda_activate:
command: source activate whatever-name
05_conda_install:
command: conda install -c dlr-sc pythonocc-core=7.4.0
但我遇到如下错误。
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 171, in <module>
worklog.build(metadata, configSets)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
self.run_config(config, worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 03_conda_create failed
我该如何解决这个问题?
【问题讨论】:
标签: python amazon-web-services anaconda amazon-elastic-beanstalk