问题描述
我正在尝试部署一个使用 MysqLclient 模块的 Flask 应用程序。我在requirements.txt文件中添加了“MysqLclient==2.0.3”,但它给了我一个提到的错误: 希望获得解决方案以解决此问题并部署我的应用程序。
*Collecting MysqLclient==2.0.3
Downloading MysqLclient-2.0.3.tar.gz (88 kB)
2021/04/30 14:51:41.371493 [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-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/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-n398ytz1
cwd: /tmp/pip-install-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/
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-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/setup.py",line 15,in <module>
Metadata,options = get_config()
File "/tmp/pip-install-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/setup_posix.py",line 70,in get_config
libs = MysqL_config("libs")
File "/tmp/pip-install-ev789p02/MysqLclient_e4290fdb04994f22bf4d9325b9d91254/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/30 14:51:41.371508 [INFO] Executing cleanup logic
2021/04/30 14:51:41.371596 [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":1619794301,"severity":"ERROR"},{"msg":"Instance deployment Failed. For details,see 'eb-engine.log'.","severity":"ERROR"}]}]}*
解决方法
我在 django 项目中编辑了两个文件。
.ebextensions/packages.config
packages:
yum:
python3-devel: []
mariadb-devel: []
requirements.txt
...
mysqlclient // just remove ==2.0.3
...