在 os x 10.6 上安装 rpy2 时出错:无法执行 gcc-4.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它似乎认为您正在使用 OSX 10.3:
build/temp.macosx-10.3
,这可能是它尝试寻找旧的 gcc 编译器的原因。您应该能够使用 CC 环境覆盖编译器:
我认为这是一个 典型的 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:
I think it's a typical distutils issue.
::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
如果有帮助的话,我用符号链接解决了这个问题,我认为它对你有用。我写这篇文章时考虑的是我的 gcc 版本,即 4.2:
好了!
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:
There ya go!
一个想法会将 gcc-4.0 指向默认的 gcc 标志:
An Idea would point gcc-4.0 to the default gcc flag: