简体   繁体   English

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

[英]error installing rpy2 on os x 10.6: unable to execute gcc-4.0

I am attempting to install rpy2 using pip with: 我正在尝试使用pip安装rpy2:

    $ 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. 我曾尝试使用macports安装rpy2,但安装已完成,但rpy2无法导入。 I have install XCode, Version 4.0.2 Build 4A2002a, and gcc is installed. 我安装了XCode,版本4.0.2 Build 4A2002a,并安装了gcc。

    $ 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. 它似乎正在寻找旧版本的gcc,我不知道如何将它指向正确的位置。 Any help would be greatly appreciated. 任何帮助将不胜感激。

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. 它似乎认为你正在使用OSX 10.3: build/temp.macosx-10.3 ,这可能是它试图寻找旧的gcc编译器的原因。

You should be able to overwrite the compiler with the CC environment: 您应该能够使用CC环境覆盖编译器:

export CC=gcc 
pip install rpy2

I think it's a typical distutils issue . 我认为这是一个典型的distutils问题

If it helps any, I solved this issue with sym links, and I think it will work for you. 如果它有帮助,我用sym链接解决了这个问题,我认为它对你有用。 I wrote this with my version of gcc in mind, which is 4.2: 我用我的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

There ya go! 你去吧!

An Idea would point gcc-4.0 to the default gcc flag: 一个想法会将gcc-4.0指向默认的gcc标志:

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

::HACK WARNING:: :: HACK警告::

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 这可能导致将来破坏其他东西,但是如果你不认为编译你的rpy2的gcc版本有所不同,你可以创建一个名为/usr/bin/gcc-4.0的符号链接指向/ usr / bin / gcc然后再次尝试pip安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM