r - 通过 bash 文件在本地编译 R 时出错

标签 r linux bash

我正在尝试使用 bash 文件在本地编译 R,但失败并显示以下错误:

tar: command not found
cd: R-3.2.5: No such file or directory
./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
R-3.2.5/lib64/R/bin/R: No such file or directory
sed: command not found
mv: command not found
tar: command not found

下面是我提交的 bash 文件:

#!/bin/bash
tar -xzvf R-3.2.5.tar.gz
cd R-3.2.5
./configure --prefix=$(pwd)
make
make install
cd ..
R-3.2.5/lib64/R/bin/R -e 'install.packages(c("BGLR"), 
repos="http://cran.cnr.berkeley.edu/", dependencies = TRUE)'
sed -i '/^R_HOME_DIR=/c R_HOME_DIR=$(pwd)/R' R-3.2.5/lib64/R/bin/R
mv R-3.2.5/lib64/R ./
tar -czvf R.tar.gz R/

当我直接在终端上运行相同的命令行时它工作正常,但是当我尝试使用 bash 文件运行它们时它失败了。

有人知道如何让它发挥作用吗?

最佳答案

用于运行脚本的 bash 实例似乎没有正确设置 $PATH 变量,因此找不到 tar 和其他命令。

尝试用 #!/bin/bash -l 替换第一行。添加 echo Path: $PATH 作为第 2 行并查看列出的目录之一是否实际包含 tar。你应该得到像 /bin:/sbin:/usr/bin/ 这样的东西。

关于r - 通过 bash 文件在本地编译 R 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47622829/

相关文章:

linux - grep 的输出包括搜索文件的输出

git - 使用 Git/Github 在 PC/Laptop/WebInterface 之间同步我的项目

r - 如何从列表中删除空数据框?

r - 将变量名转换为变量

R 错误 : Expecting a single string value: [type=character; extent=5]

linux - 执行二进制文件时出现"No such file or directory"错误

r - df 中的价格返回计算,其中包含许多带有 dplyr 的代码

python - 如何使用 C 读取目标文件的符号

linux - 如何在 VCD 文件中指定注释?

linux - awk 要求合并两个文件