在Mac Snow Leopard上安装MySQL 10.6.8错误

0 投票
1 回答
527 浏览
提问于 2025-04-17 14:23

我刚开始学习Django,想用我现在通过PHP设置的MySQL数据库,而不是用SQLite。不过,我主要是在Mac上编程(这让我很头疼),现在遇到了一个问题,想要运行以下代码:

python setup.py build

我是在MySQL-python-1.2.4b4这个文件夹里运行的,但出现了一个错误。我试着在网上搜索解决办法,但大多数结果都是关于XCode4在Mac OS Lion或Mountain Lion上的错误,而我用的是Snow Leopard。我找到的关于Snow Leopard的解决办法也不管用。

running develop

running egg_info

writing MySQL_python.egg-info/PKG-INFO

writing top-level names to MySQL_python.egg-info/top_level.txt

writing dependency_links to MySQL_python.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

reading manifest file 'MySQL_python.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

writing manifest file 'MySQL_python.egg-info/SOURCES.txt'

running build_ext

building '_mysql' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL

unable to execute gcc-4.2: No such file or directory

error: command 'gcc-4.2' failed with exit status 1

1 个回答

1

你提到找不到 xcodebuild,这很可能是因为你还没有安装包含各种构建工具的 Xcode 版本,比如构建 MySQL-python 中包含的 C 扩展模块所需的 gcc C 编译器。由于你在使用 OS X 10.6,也就是雪豹系统,适用于 10.6 的最新版本的 Xcode 是 Xcode 3.2.6,你可以在苹果开发者网站上免费注册后下载。具体的下载步骤可以参考这里。不过,下载的文件比较大。(对于更新的 OS X 版本,Xcode 的新版本是分成小块的,但这些新版本不支持 10.6。)好消息是:你只需要做一次,因为 10.6 的 Xcode 很可能不会再更新了!

撰写回答