2017-08-28 21 views
0

我試圖install.packages("RMySQL")和它運行的第二和接着說:錯誤install.packages:不能去除包之前安裝「DBI」

錯誤install.packages:不能包的除去之前安裝' DBI」

我做remove.packages("DBI")和它說:

remove.packages( 「DBI」) 刪除包從 '/Library/Frameworks/R.framework/Versions/3.2/Resources/library' (如 'LIB' 是不確定的)

然後我重試install.packages("RMySQL")和它說:

錯誤install.packages:無法刪除之前安裝的包'DBI'

DBI依賴關係實際上並未被刪除或其他東西。或者我可能把它從錯誤的地方移走了?我很困惑。

+0

你確定你刪除'DBI'?如果你嘗試'require(DBI)',會發生什麼? – nicola

+0

你嘗試在運行'remove.packages'後重啓你的R會話嗎? – jsta

+1

我最好的猜測是'DBI'連接到你的會話,並且在連接時可能無法刪除。您可以嘗試重新啓動您的R會話,但不附帶任何軟件包,或運行'detach(「package:DBI」,unload = TRUE)''。然後'install.packages'應該可以工作。 – Benjamin

回答

1

嘗試開始R 沒有任何啓動文件,以防止DBI被加載(但發生在你的盒子上)。

然後,您應該可以刪除未連接的軟件包。

或者,從庫目錄中刪除DBI/目錄。

應該類似於此:

$ R --vanilla  ## prevent inits at load 

R version 3.4.1 (2017-06-30) -- "Single Candle" 
Copyright (C) 2017 The R Foundation for Statistical Computing 
Platform: x86_64-pc-linux-gnu (64-bit) 

R is free software and comes with ABSOLUTELY NO WARRANTY. 
You are welcome to redistribute it under certain conditions. 
Type 'license()' or 'licence()' for distribution details. 

    Natural language support but running in an English locale 

R is a collaborative project with many contributors. 
Type 'contributors()' for more information and 
'citation()' on how to cite R or R packages in publications. 

Type 'demo()' for some demos, 'help()' for on-line help, or 
'help.start()' for an HTML browser interface to help. 
Type 'q()' to quit R. 

> ls()    ## no variables 
character(0) 
> search()   ## no packages besides Base 
[1] ".GlobalEnv"  "package:stats"  "package:graphics" 
[4] "package:grDevices" "package:utils"  "package:datasets" 
[7] "package:methods" "Autoloads"   "package:base"  
>