MySQL EC2 实例 Ubuntu 20.04 上的客户端安装错误
MySQL Client installation error on Ubuntu 20.04 in EC2 instance
使用缓存 mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/websiteuser/newenv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py'"'"';
__file__='"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/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-q2ahr_b3
cwd: /tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/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
我已使用以下方法修复它:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
然后:
pip install mysqlclient
这是 Ubuntu 的编译问题。
使用缓存 mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/websiteuser/newenv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py'"'"';
__file__='"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/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-q2ahr_b3
cwd: /tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/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
我已使用以下方法修复它:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
然后:
pip install mysqlclient
这是 Ubuntu 的编译问题。