Error: .onLoad failed in loadNamespace() for 'tcltk', details:

Error: .onLoad failed in loadNamespace() for 'tcltk', details:

我有 Archlinux,我尝试 运行 install.packages("zoo"),但我收到以下错误消息:

Error: .onLoad failed in loadNamespace() for 'tcltk', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib/R/library/tcltk/libs/tcltk.so': libtk8.6.so: cannot open shared object file: No such file or directory

我知道这个问题已经在这个网站上被问过了,但我找不到有效的答案。

capabilities("tcltk")
# tcltk 
#  TRUE

library(tcltk)

Error : .onLoad failed in loadNamespace() for 'tcltk', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib/R/library/tcltk/libs/tcltk.so': libtk8.6.so: cannot open shared object file: No such file or directory Error: package or namespace load failed for ‘tcltk’

知道如何解决这个问题吗?

Archlinux 提供了您的系统正在搜索的所需软件包。

  1. 在您的系统上安装 this 软件包
  2. 随后通过 install.packages("tcltk") 在 R 中安装 tcltk
  3. 现在您可以完全安装软件包 zooinstall.packages("zoo")

这应该可以解决您的问题。

在我的例子中,应该首先选择镜像。 因此,如果您看到 "please select a cran mirror for use in this session",请使用 chooseCRANmirror()。这对我有用。该错误仅发生在控制台中,而不发生在 Rstudio 中。