软件包安装需要更新版本的依赖项

Package installation requires newer version of dependency

安装 mapview 时出现错误:namespace ‘DBI’ 0.6-1 is being loaded, but >= 0.8 is required

> install.packages("mapview")
> ... 
> Error: package or namespace load failed for ‘sf’ in loadNamespace(j <- i[[1L]], 
> c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
    namespace ‘DBI’ 0.6-1 is being loaded, but >= 0.8 is required
> ...

但是我安装了 DBI v 1.0.0。

> library(DBI)
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] DBI_1.0.0 sf_0.7-0 

loaded via a namespace (and not attached):
 [1] compiler_3.4.4 magrittr_1.5   class_7.3-14   tools_3.4.4    units_0.6-1    yaml_2.1.14   
 [7] Rcpp_0.12.19   grid_3.4.4     e1071_1.7-0    classInt_0.2-3 spData_0.2.9.4

我已经尝试卸载并重新安装 DBI。

我还可以尝试什么?

您的系统上可能安装了多个版本的 DBI;使用 installed.packages() 来验证这一点,如果可能的话,通过重复调用 remove.packages("DBI").

来删除所有内容

如果无法删除一个或多个 DBI 包(例如,在系统范围的 .libPaths() 位置),一种解决方法是安装所需的包而不测试它是否已被删除安装正确

install.packages("mapview", INSTALL_opts="--no-test-load")