Error in install.packages : cannot remove prior installation of package
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Error in install.packages : cannot remove prior installation of package相关的知识,希望对你有一定的参考价值。
Error in install.packages : cannot remove prior installation of package
目录
Error in install.packages : cannot remove prior installation of package
#导入explore包进行EDA分析
#发生如下htmltools问题
library(explore)
# library('survival')
Warning message: "程辑包'explore'是用R版本4.1.1 来建造的"
Error: package or namespace load failed for 'explore' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): 载入了名字空间'htmltools' 0.5.1.1,但需要的是>= 0.5.2 Traceback: 1. library(explore) 2. tryCatch({ . attr(package, "LibPath") <- which.lib.loc . ns <- loadNamespace(package, lib.loc) . env <- attachNamespace(ns, pos = pos, deps, exclude, include.only) . }, error = function(e) { . P <- if (!is.null(cc <- conditionCall(e))) . paste(" in", deparse(cc)[1L]) . else "" . msg <- gettextf("package or namespace load failed for %s%s:\\n %s", . sQuote(package), P, conditionMessage(e)) . if (logical.return) . message(paste("Error:", msg), domain = NA) . else stop(msg, call. = FALSE, domain = NA) . }) 3. tryCatchList(expr, classes, parentenv, handlers) 4. tryCatchOne(expr, names, parentenv, handlers[[1L]]) 5. value[[3L]](cond) 6. stop(msg, call. = FALSE, domain = NA)
#尝试安装htmltools
install.packages('htmltools')
package 'htmltools' successfully unpacked and MD5 sums checked
Warning message: "cannot remove prior installation of package 'htmltools'" Warning message in file.copy(savedcopy, lib, recursive = TRUE): "拷贝D:\\anaconda\\envs\\r4-base\\lib\\R\\library\\00LOCK\\htmltools\\libs\\x64\\htmltools.dll到D:\\anaconda\\envs\\r4-base\\lib\\R\\library\\htmltools\\libs\\x64\\htmltools.dll时出了问题:Permission denied " Warning message: "restored 'htmltools'"
The downloaded binary packages are in C:\\Users\\user\\AppData\\Local\\Temp\\RtmpWYKsTU\\downloaded_packages
#删除原来就版本的htmltools文件
.libPaths()
#找到安装目录删除htmltools文件
#删除旧文件后打开R terminal安装
(r4-base) C:\\Users\\user>R
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。
R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。
> install.packages('htmltools')
--- 在此連線階段时请选用CRAN的鏡子 ---
Content type 'application/zip' length 347692 bytes (339 KB)
downloaded 339 KB
package 'htmltools' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\\Users\\user\\AppData\\Local\\Temp\\RtmpCGoVIr\\downloaded_packages
>
#再次加载explore包OK
library(explore)
# library('survival')
Warning message: "程辑包'explore'是用R版本4.1.1 来建造的"
参考:Error in install.packages : cannot remove prior installation of package ‘DBI’
参考:https://github.com/tobigithub/caret-machine-learning/issues/3
参考:R
以上是关于Error in install.packages : cannot remove prior installation of package的主要内容,如果未能解决你的问题,请参考以下文章
Warning in install.packages : package ‘RGtk2’ is not available for this version of R
Warning in install.packages : package ‘RGtk2’ is not available for this version of R
解决:ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。错误记录
ERROR: Could not install packages due to an EnvironmentError 加--user 也无效的情况