为什么出现错误:命令'llvm-gcc-4.2'失败,退出状态为1

2024-05-13 03:51:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在设置OSX10.7。

我正在使用Python的默认安装:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

我使用一个基于Python的包管理器easy_install。 Easy_install似乎找不到编译器。

编辑:当我试图安装MySQL python时,出现了以下错误:

$ sudo easy_install MySQL-python 
Password:
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.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1

错误:安装程序脚本已退出,错误为:命令“llvm-gcc-4.2”失败,退出状态为1

Xcode 4.1使用了GCC,但xcode4.2似乎有所改变。

苹果希望我们使用什么编译器? 如何设置配置以便编译OSS?


Tags: installnohttpnet错误easymysqlfiles
3条回答

听起来你遇到了this issue。该线程显示了多种解决方案。

希望能有所帮助。

除了安装Xcode之外,还可以通过以下方式安装GCC和相关工具:

https://github.com/kennethreitz/osx-gcc-installer

当我从OSX10.6升级到10.7时,我遇到了同样的问题。如果您从10.6升级到10.7,那么您的Python版本可能从2.6升级到2.7,因此您可能需要重新安装大部分Python包。

以下是对我有用的:

  1. 从应用程序商店安装最新版本的XCode
  2. 在XCode中,转到首选项->;下载->;组件
  3. 下载命令行工具

这就是你要做的。尝试在新的shell中重新安装。命令行工具安装将把llvm-gcc-4.2放入/usr/bin中,该文件应该在默认路径中。安装程序也会处理库路径和一些你不想知道的东西,除非有什么东西坏了。

10.9编辑

如果您运行的是10.9或更高版本,我认为您可以从命令行运行它来安装命令行工具:

xcode-select --install

我还没有证实这是一个真正的解决问题的方法。

相关问题 更多 >