Skip to main content
 首页 » 编程设计

python之带有 python 3.4 的 Elastic Beanstalk 仍然使用 python 2.7

2025年02月15日9txw1958

我只是使用 EB 和 python 3.4 和 Django 启动了一些环境,但它一直失败,看起来错误发生在使用 pip install -r requirements.txt 安装时,这是来自网络的事件控制台:

Time    Type    Details 
2017-10-06 20:22:39 UTC-0600    WARN    Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 69 seconds ago and took 14 minutes. 
2017-10-06 20:22:20 UTC-0600    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation. 
2017-10-06 20:21:17 UTC-0600    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 
2017-10-06 20:21:17 UTC-0600    ERROR   [Instance: i-0b46caf0e3099458c] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 
2017-10-06 20:21:14 UTC-0600    ERROR   Your requirements.txt is invalid. Snapshot your logs for details. 

我遵循了本教程:django-elastic-beanstalk-django和 deploying-a-django-app-and-postgresql-to-aws-elastic-beanstalk两者都停留在同一步骤

请您参考如下方法:

我遇到了完全相同的问题。这是我找到的解决方案:

  1. 转到您环境的配置
  2. 点击Instances的conf按钮
  3. 在Server 部分下,检查您的Custom AMI ID

现在,离开页面并转到 AWS EC2 Console page

  1. 按启动实例
  2. 您现在将进入第 1 步:选择 Amazon 系统镜像 (AMI)
  3. 多田!您将看到以下可供选择的 ami id:

  4. 回到no.3填写Custom AMI ID,引用no.6 (仅供引用,我使用的是 amazon linux,但由您决定)

  5. 点击应用,等待配置完成
  6. 重新按照部署django应用
  7. 完成!