我遇到了 R 的问题,我似乎无法弄清楚如何解决。
尝试从源代码安装 R 包时,我遇到了以下错误:
* installing *source* package ‘cthresh’ ... ** libs *** arch - i386 sh: make: command not found ERROR: compilation failed for package ‘cthresh’ * removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/cthresh’
这会让您认为我没有安装编译器或未设置 $PATH。两者都不是真的。我已经安装了 XCode 并且 echo $PATH 给我:
echo $PATH
/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/admn/bin:/usr/local/bin:/Users/admn/bin:/usr/local/bin:/Users/admn/bin:/usr/local/bin:/Developer-3.2.5/usr/bin:/Users/admn/bin:/usr/local/bin:/Developer-3.2.5/usr/bin
所以你可以看到 Developer 出现在/usr/bin 中
我什至通过以下方式确认:
export PATH=${PATH}:/Developer-3.2.5/usr/bin
如果我在 bash 或 sh 中调用“make”:
sh-3.2$ make make: * No targets specified and no makefile found. Stop.
bash-3.2$ make make: * No targets specified and no makefile found. Stop.
编译器在那里:
bash-3.2$ gcc i686-apple-darwin10-gcc-4.2.1: no input files
bash-3.2$ g++ i686-apple-darwin10-g++-4.2.1: no input files
那么是什么给了?为什么 R 不能“制造”?我真的对此不知所措,似乎无法在任何地方找到答案!我的猜测是 R 没有在寻找合适的编译器之类的东西,但我无法弄清楚如何检查它在寻找什么以及为什么它在“make”时失败
我在 MacBook Pro 上使用 OSX Lion。请帮忙!
---编辑----
好的,我在这个问题上取得了一些进展。尽管我添加了
PATH=${PATH}:/Developer-3.2.5/usr/bin
对于我的 bash/sh .profile,我还需要将它添加到 .Renviron 文件中。我在以下位置找到该文件:/Library/Frameworks/R.framework/Versions/2.15/Resources/etc/
但现在我收到了这个错误:
- installing source package ‘cthresh’ ... ** libs * arch - i386 make: * No rule to make target
._cthreb.o', needed by
cthresh.so'. Stop. ERROR: compilation failed for package ‘cthresh’
这让我觉得可能有额外的东西要添加到这个 .Renviron 文件中?关于什么的任何想法?
最佳答案
您需要从 Xcode 4 for Lion 的首选项中安装“命令行工具”。否则,仅在 Lion 中安装 Xcode 无法使用 gcc。
关于r - 在 Mac OSX 中从源安装 R 包时出错-找不到 "make"命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11045117/