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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10433745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:10:50  来源:igfitidea点击:

llvm-gcc missing on Mac OS X Lion: can not install mysql-python

xcodeosx-lionmysql-pythonllvm-gcc

提问by alexpirine

I recently upgraded to Mac OS X 10.7 from 10.6.

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

I decided to use Python 2.7.

我决定使用 Python 2.7。

But when I'm trying to install the MySQLdb module to run Django, it fails:

但是当我尝试安装 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

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

The reason is that I no longer have llvm-gccnor gccbinaries.

其原因是,我不再有llvm-gcc,也没有gcc二进制文件。

I tried to upgrade XCode from 3.something to 4.3.2, but it din't help. It comes as a simple app and it doesn't populate /usr/binwith llvm-gcc.

我试图将 XCode 从 3.something 升级到 4.3.2,但没有帮助。它是作为一个简单的应用程序,它不填充/usr/binllvm-gcc

What am I doing wrong?

我究竟做错了什么?

回答by Ned Deily

In Xcode 4.3's Preferencesmenu, select Downloadsand then install Command Line Tools.

在 Xcode 4.3 的Preferences菜单中,选择Downloads并安装Command Line Tools.

回答by Shaun

making a symlink worked for me:

制作符号链接对我有用:

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