我正在尝试在 Cygwin 上为 python 安装 MySQLdb。不幸的是,当我运行 python setup.py build
时,出现以下错误:
$ python setup.py build
/bin/sh: /usr/local/bin/mysql_config: No such file or directory
Traceback (most recent call last):
File "setup.py", line 16, in <module>
metadata, options = get_config()
File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 24, in mysql_config
raise EnvironmentError, "%s not found" % mysql_config.path
EnvironmentError: /usr/local/bin/mysql_config not found
显然我没有安装 mysql_config
,我想这就是问题所在。这在 MySQLdb 的自述文件中提到,但它没有解释如何绕过它或如何安装 mysql_config。
所以也许这很简单:如何为 Cygwin 安装 mysql_config
?
或者可能比这更难。
仅供引用:我有 python 2.5.2 和 MySQL 5.1.30,在 Cygwin 下运行。
最佳答案
我是怎么做到的:
首先我安装了apt-cyg
.有了这个:
# apt-cyg install gcc # older name
apt-cyg install gcc-core # as of 2015
apt-cyg install python-setuptools
easy_install pip
pip install -U mysql-python
关于python - 有人在 Cygwin 上安装 MySQLdb for Python 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/520865/