python - 有人在 Cygwin 上安装 MySQLdb for Python 吗?

标签 python mysql cygwin

我正在尝试在 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/

相关文章:

javascript - 需要帮助来查找我的查询中的语法错误

git - 如何停止 git 在 cygwin bash 中挂起

python - 用python将两个音频文件混合在一起

python - 计算 sympy 中具有两个索引的序列

python - Django:向 UserCreationForm 添加其他字段

MySQL for Excel 时间列

python - 使用 Teradata 模块将 Python 与 Teradata 连接

mysql - 为什么这会给我错误的 customerNumber?

android - 在windows上使用android ndkr8通过cygwin编译ffmpeg2

使用 Cygwin+SSH 访问 Git-server 存储库