今天做BP神经网络和SVM,想安装AMORE包,输入以下代码:
install.packages("AMORE")
报错:
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'AMORE'
经过搜索,得出以下解决方法:
Step 0. 将Rstudio更新到最新版本:
install.packages("installr")
library(installr)
updateR()
Step 1. 网页下载安装RTools:
安装版本:rtools40v2-x86_64.exe
Step 2. 运行代码:
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
Sys.which("make")
能显示“make”路径即可。
"D:\\rtools40\\usr\\bin\\make.exe"
Step 3. 尝试安装jsonlite包,安装成功即代表RTools 可使用。
install.packages("jsonlite", type = "source")
Step 4. 安装原本报错的包,仍然报错:
install.packages("AMORE")
Warning in install.packages :
package ‘AMORE’ is not available for this version of RA version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
于是改换安装方法,进行本地安装。官网下载该包的压缩包形式后,进行安装:
install.packages("C:/Users/.../AppData/Local/Temp/AMORE_0.2-16.tar.gz", repos = NULL, type = "source")
……
* DONE (AMORE)
Making 'packages.html' ... done
调用该包:
library("AMORE")
无报错信息。newff等函数均可正常使用。
贴大佬教程: