我正在AWS的Elastic Beanstalk环境中部署flask应用程序。它在我的本地应用程序中运行完全正常,但是当我将其上传到Beanstalk时,在日志文件中出现以下错误
[ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr: ERROR: Command errored out with exit status 1:
command: /var/app/venv/staging-LQM1lest/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-abr_xfaw
cwd: /tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-tu8sxhxj/mysqlclient_f51fe93483714a68ae43574db1c80ed5/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.0.3
ERROR: No matching distribution found for mysqlclient==2.0.3
2021/04/04 16:02:21.681275 [INFO] Executing cleanup logic
2021/04/04 16:02:21.681366 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to install application dependencies. The deployment failed.","timestamp":1617552141,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1617552141,"severity":"ERROR"}]}]}
我的requirements.txt文件如下:
aniso8601==8.0.0
click==7.1.2
Flask==1.1.2
Flask-JWT==0.3.2
Flask-MySQLdb==0.2.0
Flask-RESTful==0.3.8
Flask-SQLAlchemy==2.4.3
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
mysqlclient==2.0.3
PyJWT==1.4.2
pytz==2020.1
six==1.15.0
SQLAlchemy==1.3.18
Werkzeug==1.0.1
甚至当我第一次在本地尝试使用pip安装-r requirements.txt时,我也遇到了同样的问题
但是,我使用以下步骤解决了它
1. $ brew install mysql
2. $ pip install mysqlclient
我假设在服务器上也需要做类似的事情。有人能帮我弄清楚如何在服务器上运行吗
目前没有回答
相关问题 更多 >
编程相关推荐