在Mac上将R升级到3.6.0后无法加载库 [英] Fail to load libraries after upgrading R to 3.6.0 on Mac
问题描述
我需要安装R软件包quadprog
,该软件包仅适用于3.6.0版的R.所以我安装了R(3.6.0
版本),并用RStudio
打开它.但是,即使使用install.packages("package_name")
成功安装软件包 后,现在我无法加载任何库.具体来说,我需要加载的库是caret
,forecast
和ggplot2
.我尝试重新安装 R ,但仍然无法正常工作.我收到的错误消息是
I needed to install the R package quadprog
, which only works for R with version 3.6.0. So I installed R (3.6.0
version), and open it with RStudio
. But now I failed to load any libraries, even after I installed the packages successfully using install.packages("package_name")
. Specifically, the libraries I need to load are caret
, forecast
and ggplot2
. I tried re-installing R but it still does not work. The error message I get is
错误:在预测"中,程序包或名称空间加载失败 dyn.load(文件,DLLpath = DLLpath,...):无法加载共享对象 '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so': dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6):找不到符号:___cxa_uncaught_exceptions引用自: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib 预期存在于:/usr/lib/libc++abi.dylib中 /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc ++.1.dylib
Error: package or namespace load failed for ‘forecast’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so': dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: ___cxa_uncaught_exceptions Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib Expected in: /usr/lib/libc++abi.dylib in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
使用install.packages("Rcpp")
成功安装Rcpp
软件包后,尝试library(Rcpp)
时仍收到上述消息.所以我在这里完全迷迷糊糊...(在升级之前,一切正常,除了我无法安装quadprog
,所以也无法安装forecast
软件包).谁能帮我解决这个问题?
After installing Rcpp
package successfully with install.packages("Rcpp")
, I still got the message above when I tried library(Rcpp)
. So I am completely stumbled here...(before upgrades, everything works fine except I cannot install quadprog
, so cannot install forecast
package as well). Can anyone please help me fix this issue?
请在下面的图片中查看这些软件包是否存储在R.
Please see below the images showing that the packages are stored in the same directory path of the R.
推荐答案
我了解到,升级到R
的较新版本后,您需要重新编译旧软件包.在R
终端
I read that you need to recompile your old packages after upgrading to newer version of R
. Run the following line in your R
terminal
update.packages(ask=FALSE,
checkBuilt=TRUE,
repos="https://cloud.r-project.org")
然后
install.packages(c("Rcpp", "caret", "forecast", "ggplot2", "quadprog"),
dependencies=TRUE,
repos="https://cloud.r-project.org")
这篇关于在Mac上将R升级到3.6.0后无法加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!