如何在 Amazon Web Services EC2 实例上安装 MySQL-python?

How to install MySQL-python on Amazon Web Services EC2 instance?

我在 AWS 上创建了一个 EC2 实例,并使用 PuTTY 连接到它。
我无法使用 python [= 安装 MySQL-python 17=]pip命令如下:
pip install MySQL-python(通过root权限)

这是错误的控制台输出

Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-JGbAEI/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-JGbAEI/MySQL-python/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-JGbAEI/MySQL-python/setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JGbAEI/MySQL-python


但是我可以使用 pip 安装其他包
请指导。

好像 mysql_config 不见了,所以请确保 mysql_config 确实安装了。

例如,在 Debian/Ubuntu 上,您必须安装软件包:

sudo apt-get install libmysqlclient-dev

mysql_config 在 Amazon Linux 上安装以下软件包后可用:

sudo yum install -y mysql-devel