我正在尝试使用 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/