部署Flask应用程序时,如何修复此Elastic Beanstalk错误:系统上未找到Python 3.7.0
我正在尝试使用EB CLI部署我的Flask应用程序。我收到错误“创建环境操作已完成,但有错误”。观察环境日志,服务器似乎缺少正确的Python版本 下面是EB环境详细信息、我的PIP文件、EB CLI输出和部署日志中的错误 我如何解决这个问题 环境详情: 文件: CLI输出: 日志:部署Flask应用程序时,如何修复此Elastic Beanstalk错误:系统上未找到Python 3.7.0,python,amazon-web-services,flask,amazon-elastic-beanstalk,Python,Amazon Web Services,Flask,Amazon Elastic Beanstalk,我正在尝试使用EB CLI部署我的Flask应用程序。我收到错误“创建环境操作已完成,但有错误”。观察环境日志,服务器似乎缺少正确的Python版本 下面是EB环境详细信息、我的PIP文件、EB CLI输出和部署日志中的错误 我如何解决这个问题 环境详情: 文件: CLI输出: 日志: 根据评论,问题在于EB使用的是Python3.7.6,而OP的依赖项需要版本3.7.0 解决方案是将依赖项更改为python3.7.6 可以找到在EB上运行的当前python版本: 64位Amazon Linux
根据评论,问题在于EB使用的是
Python3.7.6
,而OP的依赖项需要版本3.7.0
解决方案是将依赖项更改为python3.7.6
可以找到在EB上运行的当前python版本:
64位Amazon Linux 2 v3.0.1,运行Python 3.7-Python 3.7.6
EB使用Python 3.7.6,因此也许用它代替3.7.0会有所帮助。谢谢@Marcin,这就成功了。这是在哪里记录的?我刚刚在我的EB实例上检查了它的确切python版本。如果你不介意的话,我会给你一个答案,以备将来参考。答案中还有指向EB上Python版本的链接。谢谢@Marcin,这很有用
Application name: server_eb
Region: eu-west-2
Deployed Version: XXX
Environment ID: XXX
Platform: arn:aws:elasticbeanstalk:eu-west-2::platform/Python 3.7 running on 64bit Amazon Linux 2/3.0.1
Tier: WebServer-Standard-1.0
CNAME: UNKNOWN
Updated: 2020-06-02 16:53:10.321000+00:00
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
flask = "~=1.1.1"
python-dotenv = "~=0.13.0"
psycopg2 = "~=2.8.5"
flask-sqlalchemy = "~=2.4.1"
flask-migrate = "~=2.5.3"
flask-dance = {extras = ["sqla"],version = "~=3.0.0"}
flask-login = "~=0.4.1"
blinker = "~=1.4"
flask-session = "==0.3.1"
redis = "==3.4.1"
[scripts]
migrate="flask db upgrade"
start="flask run --cert=cert.pem --key=key.pem"
[requires]
python_version = "3.7.0"
2020-06-02 16:54:55 ERROR [Instance: XXX] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-06-02 16:54:55 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-06-02 16:55:57 ERROR Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2020/06/02 16:54:55.030996 [ERROR] An error occurred during execution of command [app-deploy] - [SetUpPythonEnvironment]. Stop running the command. Error: fail to install Gunicorn with error Command /bin/sh -c python3 -m pipenv install gunicorn --skip-lock failed with error exit status 1. Stderr:Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Warning: Python 3.7.0 was not found on your system…
You can specify specific versions of Python with:
$ pipenv --python path/to/python