zoukankan      html  css  js  c++  java
  • centos7 安装rstan (R)

    install.packages("rstan") 安装失败

    试开URL’https://mirrors.e-ducation.cn/CRAN/src/contrib/rstan_2.21.2.tar.gz'
    Content type 'application/x-gzip' length 1152008 bytes (1.1 MB)
    ==================================================
    downloaded 1.1 MB

    * installing *source* package ‘rstan’ ...
    ** 成功将‘rstan’程序包解包并MD5和检查
    ** using staged installation
    ** libs
    Error in .shlib_internal(args) :
      C++14 standard requested but CXX14 is not defined
    * removing ‘/usr/lib64/R/library/rstan’

    下载的程序包在
        ‘/tmp/RtmpHaZKZK/downloaded_packages’里
    更新'.Library'里的HTML程序包列表
    Making 'packages.html' ... 做完了。
    Warning message:
    In install.packages("rstan") : 安装程序包‘rstan’时退出狀態的值不是0

    =====================================

    安装 步骤如下:

    安装新版本gcc (Install gcc gcc-9.1.0)

    centos7的预装gcc版本为4.8.5,刚好不满足rstan的最低要求。以下为gcc-9.1.0安装流程(一下流程会覆盖gcc,谨慎操作):

    ### Install gcc gcc-9.1.0
    wget
    http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-9.1.0/gcc-9.1.0.tar.gz tar -xzvf gcc-9.1.0.tar.gz cd gcc-9.1.0 ./contrib/download_prerequisites mkdir build cd build ../configure --prefix=/usr -enable-checking=release --enable--long-long--with-system-zlib -enable-languages=c,c++,fortran -disable-multilib # 这样安装会覆盖原有gcc make -j8 ## error make install ## error ldconfig -v

    make[6]: *** [ios_locale.lo] 错误 1
    make[6]: 离开目录“/home/software/gcc-9.1.0/build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++98”
    make[5]: *** [all-recursive] 错误 1
    make[5]: 离开目录“/home/software/gcc-9.1.0/build/x86_64-pc-linux-gnu/libstdc++-v3/src”
    make[4]: *** [all-recursive] 错误 1
    make[4]: 离开目录“/home/software/gcc-9.1.0/build/x86_64-pc-linux-gnu/libstdc++-v3”
    make[3]: *** [all] 错误 2
    make[3]: 离开目录“/home/software/gcc-9.1.0/build/x86_64-pc-linux-gnu/libstdc++-v3”
    make[2]: *** [all-stage1-target-libstdc++-v3] 错误 2
    make[2]: 离开目录“/home/software/gcc-9.1.0/build”
    make[1]: *** [stage1-bubble] 错误 2
    make[1]: 离开目录“/home/software/gcc-9.1.0/build”
    make: *** [all] 错误 2
    您在 /var/spool/mail/root 中有邮件
    (base) [root@ibiomed build]# make install
    make[1]: 进入目录“/home/software/gcc-9.1.0/build”
    /bin/sh ../mkinstalldirs /usr /usr
    make[2]: 进入目录“/home/software/gcc-9.1.0/build/fixincludes”
    make[2]: *** 没有规则可以创建目标“install”。 停止。
    make[2]: 离开目录“/home/software/gcc-9.1.0/build/fixincludes”
    make[1]: *** [install-fixincludes] 错误 2
    make[1]: 离开目录“/home/software/gcc-9.1.0/build”
    make: *** [install] 错误 2
    您在 /var/spool/mail/root 中有邮件

     

     

    安装Rcpp和rstan (install Rcpp和rstan )

    进入R,输入以下命令:

    dotR = file.path(Sys.getenv("HOME"), ".R")
    if (!file.exists(dotR)) dir.create(dotR)
    M = file.path(dotR, "Makevars")
    if (!file.exists(M)) file.create(M)
    cat("\nCXX14FLAGS=-O3 -march=native -mtune=native -fPIC", "CXX14=g++", file = M, sep = "\n", append = TRUE)
    install.packages("Rcpp") # 很重要,必须保持一致性编译
    Sys.setenv(MAKEFLAGS = "-j8")
    install.packages("rstan", type = "source")
    install.packages("ggstatsplot")
  • 相关阅读:
    leetcode 对称二叉树
    leetcode 验证二叉搜索树
    蓝桥杯 完美的代价 贪心
    蓝桥杯 字符串对比 模拟
    蓝桥杯 芯片测试 极限找规律
    蓝桥杯 2n皇后问题 深搜
    74. 搜索二维矩阵
    二分 34
    二分 35
    二分 69
  • 原文地址:https://www.cnblogs.com/emanlee/p/15613165.html
Copyright © 2011-2022 走看看