R包arules在macos上安装错误

时间:2017-11-17 14:04:30

标签: r anaconda rstudio macos-sierra arules

我试图安装' arules'从R控制台中包含以下内容 * 建立: macOS Sierra v 10.12.6,R version 3.4.2,RStudio 1.1.383,Anaconda 5.0; anaconda客户端版本1.6.5,python 3.6.3

  • 使用以下命令在R控制台内:

    install.packages("arules")
    
  • 错误输出:

    install.packages("arules")
    trying URL 'https://cran.revolutionanalytics.com/src/contrib/arules_1.5-4.tar.gz'
    Content type 'application/octet-stream' length 1359205 bytes (1.3 MB)
    ==================================================
    downloaded 1.3 MB
    
    * installing *source* package ‘arules’ ...
    ** package ‘arules’ successfully unpacked and MD5 sums checked
    ** libs
    x86_64-apple-darwin13.4.0-clang -I/Users/alsabay/anaconda3/lib/R/include -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/alsabay/anaconda3/include  -DNDEBUG -DNIMAPFN -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/alsabay/anaconda3/include  -c arrayIndex.c -o arrayIndex.o
    make: x86_64-apple-darwin13.4.0-clang: No such file or directory
    make: *** [arrayIndex.o] Error 1
    ERROR: compilation failed for package ‘arules’
    * removing ‘/Users/alsabay/anaconda3/lib/R/library/arules’
    
    The downloaded source packages are in ‘/private/var/folders/lc/_068llz1667dp1m75b_js4hr09p31n/T/RtmpObrwiG/downloaded_packages’
    Updating HTML index of packages in '.Library'
    Making 'packages.html' ... done
    Warning message:
    In install.packages("arules") :
      installation of package ‘arules’ had non-zero exit status
    

我已经更新了xcode命令行工具到版本9.1,我仍然得到相同的错误。我也尝试从RStudio安装它并检查依赖项,并且我在依赖包上添加了编译错误时得到了同样的错误。我在这里已经没有线索了,虽然我知道这是一种铿锵的编译错误但不确定后续步骤。请帮忙。

1 个答案:

答案 0 :(得分:0)

以下是我使用上述建议解决此问题的方法

  1. 按照说明下载macng的clang4     cran.r-project.org/bin/macosx/tools

  2. 将clang4复制到/ usr / local / clang4。

  3. 使用。目录〜/ .R创建Makevars文件         以下环境变量。

    CC=/usr/local/clang4/bin/clang
    CXX=/usr/local/clang4/bin/clang++
    LDFLAGS=-L/usr/local/clang4/lib
    FC=/usr/local/bin/gfortran
    F77=/usr/local/bin/gfortran
    
  4. cran.r-project.org/bin/macosx/tools下载并安装gfortran-4.2.3.pkg(这有安装程序)。

  5. 启动R控制台并输入

    install.packages('arules')
    install.packages('arulesViz')