在 os x 10.6 上安装 rpy2 时出错:无法执行 gcc-4.0

发布于 2024-11-26 09:44:43 字数 1065 浏览 0 评论 0原文

我正在尝试使用 pip with: 安装 rpy2

    $ sudo pip install rpy2

,退出时出现错误:

    gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -I./rpy/rinterface -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/lib/R/include/x86_64 -I/opt/local/lib/R/include -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.3-fat-2.7/./rpy/rinterface/_rinterface.o

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

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

我也尝试使用 macports 安装 rpy2,但是安装已完成,但 rpy2 不会导入。我已经安装了 XCode,版本 4.0.2 Build 4A2002a,并且安装了 gcc。

    $ which gcc

returns:

    /usr/bin/gcc

    $ gcc

returns:

    i686-apple-darwin10-gcc-4.2.1: no input files

似乎它正在寻找旧版本的 gcc,我不知道如何将它指向正确的位置。任何帮助将不胜感激。

I am attempting to install rpy2 using pip with:

    $ sudo pip install rpy2

which exits with an error:

    gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -I./rpy/rinterface -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/lib/R/include/x86_64 -I/opt/local/lib/R/include -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.3-fat-2.7/./rpy/rinterface/_rinterface.o

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

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

I have attempted to also install rpy2 with macports, however the install completed but rpy2 would not import. I have install XCode, Version 4.0.2 Build 4A2002a, and gcc is installed.

    $ which gcc

returns:

    /usr/bin/gcc

and

    $ gcc

returns:

    i686-apple-darwin10-gcc-4.2.1: no input files

It seems that it is looking for an older version of gcc and I have no idea how to point it in the right place. Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一抹淡然 2024-12-03 09:44:43

它似乎认为您正在使用 OSX 10.3:build/temp.macosx-10.3,这可能是它尝试寻找旧的 gcc 编译器的原因。

您应该能够使用 CC 环境覆盖编译器:

export CC=gcc 
pip install rpy2

我认为这是一个 典型的 distutils 问题

It seems to think that you're using OSX 10.3: build/temp.macosx-10.3, which might be the reason why it's trying to look for an old gcc compiler.

You should be able to overwrite the compiler with the CC environment:

export CC=gcc 
pip install rpy2

I think it's a typical distutils issue.

地狱即天堂 2024-12-03 09:44:43

::HACK 警告::

这可能会导致将来出现其他问题,但如果您认为编译 rpy2 的 gcc 版本不会产生影响,您可以创建一个名为 /usr/bin/gcc-4.0 的符号链接指向 /usr/bin/gcc,然后再次尝试 pip install

::HACK WARNING::

This may cause something else to break in the future, but if you don't think the version of gcc that compiles your rpy2 makes a difference, you could create a symlink named /usr/bin/gcc-4.0 pointing to /usr/bin/gcc and then try the pip install again

自由如风 2024-12-03 09:44:43

如果有帮助的话,我用符号链接解决了这个问题,我认为它对你有用。我写这篇文章时考虑的是我的 gcc 版本,即 4.2:

cd /usr/bin
rm cc gcc c++ g++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c++-4.2 c++
ln -s g++-4.2 g++
ln -s gcc-4.2 gcc-4.0

好了!

If it helps any, I solved this issue with sym links, and I think it will work for you. I wrote this with my version of gcc in mind, which is 4.2:

cd /usr/bin
rm cc gcc c++ g++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c++-4.2 c++
ln -s g++-4.2 g++
ln -s gcc-4.2 gcc-4.0

There ya go!

↙厌世 2024-12-03 09:44:43

一个想法会将 gcc-4.0 指向默认的 gcc 标志:

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

An Idea would point gcc-4.0 to the default gcc flag:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文