【问题标题】:Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1为什么我收到错误:命令“llvm-gcc-4.2”失败,退出状态为 1
【发布时间】:2023-03-31 15:34:02
【问题描述】:

我正在设置 os X 10.7。

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

我使用名为 easy_install 的基于 Python 的包管理器。 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,但 Xcode 4.2 似乎发生了变化。

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

【问题讨论】:

  • 你想用easy_install安装什么包?
  • 命令“失败”,不是“未找到”。向我们展示更多上下文/日志以了解您的问题。
  • 我有同样的问题,我尝试了 Xcode 和 GCC 解决方案!解决办法是什么?我需要它!

标签: python osx-lion llvm easy-install


【解决方案1】:

当我从 OSX 10.6 升级到 10.7 时,我遇到了完全相同的问题。如果您从 10.6 升级到 10.7,您的 Python 版本可能会从 2.6 升级到 2.7,因此您可能需要重新安装大部分 Python 包。

这对我有用:

  1. 从 App Store 安装最新版本的 XCode
  2. 在 XCode 中,转到 Preferences -> Downloads -> Components
  3. 下载命令行工具

这就是你需要做的。尝试在新的 shell 中再次安装。命令行工具安装会将 llvm-gcc-4.2 放入 /usr/bin 中,该路径应位于您的默认路径中。安装过程还会处理库路径和您不想知道的内容,除非出现问题。

10.9 编辑

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

xcode-select --install

我尚未验证这是对问题的实际解决方法。

【讨论】:

    【解决方案2】:

    安装 Xcode 的替代方法,通过以下方式安装 GCC 和相关工具:

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

    【讨论】:

      【解决方案3】:

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

      希望对您有所帮助。

      【讨论】:

        【解决方案4】:
        【解决方案5】:

        使用 OS X 10.7.5 (Lion)

        我尝试了 XCode 解决方案,但我的 gevent pip 安装仍然不成功。然后,我尝试从源代码构建 libevent,但 gevent 安装仍然没有成功。然而,在我这样做之后

            brew install libevent
        

        我能够使用

        成功安装 gevent
            sudo pip install gevent
        

        (注意:greenlet 也是 gevent 的一个依赖,所以你也可以尝试使用 pip 安装它。它已经安装在我的机器上。)

        【讨论】:

          【解决方案6】:

          这里的所有建议(Xcode 命令行选项和 Kenneth Reitz 的东西)都对我不起作用(我使用的是 Mac OS X 10.7.5、Xcode 4.6.3)。

          最终的帮助是改变了 mysql_config 文件中的 cflags 选项(在尝试“sudo pip install MySQL-python”时出现了关于“unreconized command line options”的错误)。

          看到这个帖子:cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-03-15
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多