R找不到sh的路径

时间:2019-09-25 07:55:23

标签: r macos igraph install.packages

在R中安装软件包存在严重问题(我在Mac OS上)。我尝试使用Rstudio安装软件包(如下):

EF Core 2

然后我在R控制台中尝试了它:

> install.packages("igraph")
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB

* installing *source* package ‘igraph’ ...
** package ‘igraph’ successfully unpacked and MD5 sums checked
** using staged installation
./configure: line 473: sed: command not found
./configure: line 472: expr: command not found
./configure: line 473: sed: command not found
./configure: line 487: sed: command not found
: error: cannot create .lineno; rerun with a POSIX shell
ERROR: configuration failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.6/site-library/igraph’
sh: rm: command not found
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/ll/jmydhb6n7jqg5rv_c58jxkkh0000gn/T/Rtmpi1rAL3/downloaded_packages’

我猜这个问题与我的PATH变量之一有关。我也尝试安装最新版本的xcode无效。以下是我可以在各种PATH上获得的详细信息:

来自Rstudio:

> install.packages("igraph")
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB

/usr/local/Cellar/r/3.6.1/lib/R/bin/R: line 143: exec: sh: not found

The downloaded source packages are in
    ‘/private/var/folders/ll/jmydhb6n7jqg5rv_c58jxkkh0000gn/T/Rtmpq31bYd/downloaded_packages’
Warning messages:
1: In system2(cmd0, args, env = env, stdout = outfile, stderr = outfile,  :
  error in running command
2: In install.packages("igraph") :
  installation of package ‘igraph’ had non-zero exit status

从R控制台

Sys.getenv("PATH")
[1] "/Users/gordon.beattie/.virtualenvs/r-reticulate/bin:/Users/gordon.beattie/.virtualenvs/r-reticulate/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/gordon.beattie/Downloads/R_packages/gliph-master/gliph/bin"

来自.Renviron

> Sys.getenv("PATH")
[1] "/usr/local/bin"

我的系统路径

R_LIBS=~/R/library
PAGER=/usr/local/bin/less
PATH=/Users/gordon.beattie/Downloads/R_packages/gliph-master/gliph/bin
PATH=/usr/local/bin
PATH=/usr/local/bin
PATH=/usr/bin
PATH=/bin
PATH=/usr/sbin
PATH=/sbin
PATH=/Users/gordon.beattie/.virtualenvs/r-reticulate/bin
PATH=/Users/gordon.beattie/.virtualenvs/r-reticulate/bin
PATH=/usr/bin:/bin:/usr/sbin
PATH=/sbin
PATH=/usr/local/bin

其他信息:

echo $PATH
/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

0 个答案:

没有答案