linux - 无法在 Linux Mint 17 上安装 R 包

标签 linux r linux-mint

在 Linux Mint 17 上运行 R 3.1.2,当我尝试安装流行的软件包时,我得到一个非零退出状态。示例 install.packages 尝试的完整输出如下:

> install.packages("plyr")
Installing package into ‘/home/joe_kendrick/R/x86_64-pc-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/plyr_1.8.1.tar.gz'
Content type 'application/x-gzip' length 393233 bytes (384 Kb)
opened URL
==================================================
downloaded 384 Kb

* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG   -I"/usr/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
/bin/bash: g++: command not found
make: *** [RcppExports.o] Error 127
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/joe_kendrick/R/x86_64-pc-linux-gnu-library/3.1/plyr’

The downloaded source packages are in
    ‘/tmp/RtmpXe52Mz/downloaded_packages’
Warning message:
In install.packages("plyr") :
  installation of package ‘plyr’ had non-zero exit status

对于我尝试安装的其他包,例如 ggplot2vegan,我得到的消息基本上是相同的,尽管在许多情况下它更冗长,因为它尝试并失败了安装依赖项。

这似乎是一个有点普遍的问题,但其他人似乎也有 outdated softwareinsufficient memory .我正在运行 Mint 和 R 的最新稳定版本,并且我有足够的 RAM 和一个交换文件,所以我认为这些都不会导致我的问题。

最佳答案

根据错误信息

 /bin/bash: g++: command not found

你需要安装一个C++编译器。我将从以下之一开始:

 sudo apt-get install build-essentials        # key tools

 sudo apt-get install r-base-dev              # many development tools for R

或者当然

 sudo apt-get install r-cran-rcpp             # to not install from source

尽管您获得的 Rcpp 可能比您需要的旧。

对于基于 Debian 的系统的用户,有一个列表 r-sig-debian

关于linux - 无法在 Linux Mint 17 上安装 R 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26793359/

相关文章:

linux - 操作系统的下载带宽差异?

linux - 打印重复条目的行号

Roxygen2 - 如何正确记录 S3 方法

c++ - 如何在 Linux 上延迟加载共享库

linux - linux上的sqlplus查询+循环

r - 来自数据帧列表 R 的多个箱线图

r - 如何在 R 中将数据 1 1 2 2 3 3 拆分为 1 2 3 1 2 3?

Linux mint 增加游标大小超过默认最大值

regex - POSIX 正则表达式 : Exclude a specified word in the list using Regex

c - 当指针指向使用 malloc() 获得的内存位置时,编译器如何处理 CONST 限定符?