#以下是caret包所依赖的所有包,可以用如下脚本进行安装预先依赖包
caret_needed_packages <- c("ps","processx","callr","prettyunits","backports","desc","pkgbuild","rprojroot","rstudioapi","numDeriv","SQUAREM","evaluate","pkgload","praise","colorspace","assertthat","utf8","lava","testthat","farver","labeling","munsell","R6","RColorBrewer","viridisLite","cli","crayon","ellipsis","fansi","pillar","pkgconfig","vctrs","stringi","prodlim","cpp11","digest","glue","gtable","isoband","rlang","scales","tibble","iterators","Rcpp","data.table","stringr","dplyr","generics","gower","ipred","lifecycle","lubridate","magrittr","purrr","tidyr","tidyselect","timeDate","ggplot2","foreach","plyr","ModelMetrics","reshape2","recipes","withr","pROC")
installed_pkgs <- installed.packages()
ind_flag<- caret_needed_packages %in% installed_pkgs
ind_needed_pkg<-caret_needed_packages[!ind_flag]
for(pkg in ind_needed_pkg){
install.packages(pkg,repos = "https://mirror.lzu.edu.cn/CRAN/")
}
或者,直接安装——需要注意的是一定注意镜像地址的选择,否则可能出现奇怪的问题。
install.packages("caret",repos = "https://mirror.lzu.edu.cn/CRAN/")
old_options<-options()
old_options$repos
options(repos = "https://mirror.lzu.edu.cn/CRAN/")
getOption("repos")
setRepositories(addURLs = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/ ")
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')
install.packages("IRkernel")
IRkernel::installspec()
IRkernel::installspec(user = FALSE)
Error in IRkernel::installspec() :
jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 1.
在window10台式机上进行配置时,发现依旧出现问题如上:
> IRkernel::installspec()
Error in IRkernel::installspec() :
jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 1.
按照上述两个方法操作之后,报错结果依据。。。。
一番网上搜索,没有头绪。
执行命令查看jupyter内核,出现如下错误:
>jupyter kernelspec list
Error executing Jupyter command 'kernelspec': [WinError 5] 拒绝访问。
也就是,权限错误——考虑权限问题,进行了如下操作:
(1)对 C:\ProgramData\Anaconda3
文件夹进行整体的权限设置:右键属性—>安全—>编辑,为当前用户设置完全权限;
执行结果:依旧失败
(2)在路径C:\ProgramData\Anaconda3\Scripts
下找到执行文件 jupyter-kernelspec.exe ,查看发现权限都是完全控制,但以管理员权限依旧无法运行;尝试在 右键属性—>安全—>编辑—>高级 中 “启用继承”:
执行结果:
> IRkernel::installspec()
[InstallKernelSpec] Installed kernelspec ir in C:\Users\zhangzhuo3\AppData\Roaming\jupyter\kernels\ir
为啥?我也不知道为啥!!!实在不太懂windows!