Mac OS X Lion中缺少llvm-gcc:无法安装mysql-python。

4

我最近从10.6升级到了Mac OS X 10.7。

我决定使用Python 2.7。

但当我尝试安装MySQLdb模块来运行Django时,安装失败:

$ sudo pip install MySQL-python
Downloading/unpacking MySQL-python
  […]
  Running setup.py install for MySQL-python
    building '_mysql' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
    unable to execute llvm-gcc-4.2: No such file or directory
    error: command 'llvm-gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='~/Sites/gugsm/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-AwMuqj-record/install-record.txt:
    running install

running build

[…]

building '_mysql' extension

creating build/temp.macosx-10.7-intel-2.7

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64

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

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

----------------------------------------

原因是我不再拥有llvm-gccgcc二进制文件。
我试图将XCode从3.x版本升级到4.3.2版本,但这并没有帮助。它只是一个简单的应用程序,它没有在/usr/bin中安装llvm-gcc
我做错了什么?
2个回答

14
在Xcode 4.3的首选项菜单中,选择下载,然后安装命令行工具

谢谢提示。一旦下载并安装好,我会告诉你这是否解决了我的问题。 - alexpirine
@Ned:谢谢!我因为这个苹果的问题而烦恼不已,你解决了我的问题 :-) - marco.m
当我尝试更新一些Ruby gem时,遇到了同样的问题。显然,一个库的Makefile期望找到usr/bin/gcc-4.2,但这个文件已经不存在了,所以我不得不将usr/bin/llvm-gcc-4.2链接到gcc-4.2 - fanaugen

4

我成功地创建了一个符号链接:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接