python - 在 Mac 上安装 MySQLdb

标签 python mysql

我有 Python 32 位,我安装了 MySQL 社区服务器 32 位,并且我正在尝试安装 MySQLdb for Python。 我运行

easy_install mysql-python

我有这个错误

> easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.4b5
Downloading http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b5.zip#md5=4f645ed23ea0f8848be77f25ffe94ade
Processing MySQL-python-1.2.4b5.zip
Running MySQL-python-1.2.4b5/setup.py -q bdist_egg --dist-dir /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/egg-dist-tmp-GjLaFB
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/temp/tmpOVVY_R
Now working in /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/temp/tmpOVVY_R/distribute-0.6.28
Building a Distribute egg in /private/var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5
/private/var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/distribute-0.6.28-py2.6.egg
unable to execute gcc-4.0: No such file or directory
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

知道为什么找不到 gcc-4.0 吗?我安装了 Xcode 和 gcc 4.2.1。

最佳答案

如果您使用的是 Mountain Lion,您的问题似乎与未安装 xcode 命令行工具有关,如果您先从 xcode 安装它们,那么这应该可以工作

关于python - 在 Mac 上安装 MySQLdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13098772/

相关文章:

Python - 根据第一个单词对文件中的行进行排序?

python - 如何使用python 3解密SQLite数据库中的项目

python - 将 Pandas DataFrame 写入现有的 MySQL 数据库表

mysql - 是否可以进行类似于 MySQL 的 DB2 表文件备份/恢复?

python - 返回两个 numpy 数组之间的公共(public)元素索引

python - Django - 从 csv 输出的外键关系获取条目

python - CPython的静态对象地址和碎片

mysql - 获取mysql中重复值的多个最大计数

mysql - 如何只计算前 5 个项目,然后将剩余的项目分组到 'other' bin 下?

php - 如何从mysql中的日期获取月份