5

我在安装Flextable时遇到问题,这似乎是因为gdtools软件包。看起来gdtools依赖于 .dylib 文件?有任何想法吗?

> install.packages("flextable")

  There is a binary version available but the source version is later:
          binary source needs_compilation
flextable  0.4.0  0.4.2             FALSE

installing the source package ‘flextable’

trying URL 'https://cran.rstudio.com/src/contrib/flextable_0.4.2.tar.gz'
Content type 'application/x-gzip' length 135276 bytes (132 KB)
==================================================
downloaded 132 KB

Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone 'default/Australia/Melbourne'
* installing *source* package ‘flextable’ ...
** package ‘flextable’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/gdtools/libs/gdtools.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/gdtools/libs/gdtools.so, 6): Library not loaded: /opt/X11/lib/libcairo.2.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/gdtools/libs/gdtools.so
  Reason: image not found
ERROR: lazy loading failed for package ‘flextable’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/flextable’
Warning in install.packages :
  installation of package ‘flextable’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/fs/2zzbjym545vgl0hvq4pvs6sc0000gn/T/Rtmpdo3FMp/downloaded_packages’
4

3 回答 3

9

我设法通过重新安装石英来解决这个问题: https ://www.xquartz.org

于 2018-01-11T09:31:28.557 回答
5

对于 mac 用户。mac os X 更新有时会发生这种情况。这需要Homebrew(可以使用以下命令安装:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. 关闭所有 R 会话(不是强制性的,但根据经验,这是最好的解决方案)。

在终端中,运行以下命令:

brew update
brew upgrade
brew reinstall cairo
  1. 打开 R 会话并运行以下代码:

    install.packages("gdtools", type = "source")

于 2018-01-12T10:29:08.373 回答
0

我会尽力提供帮助,即使我不知道您的操作系统是 Ubuntu 20.10,我也解决了如下问题(此解决方案适用于 Debian、Ubuntu 等):

在终端输入: sudo apt-get install libfontconfig1-dev

然后: sudo apt-get install libcairo2-dev

在 R 控制台类型中:

install.packages("flextable")

库(灵活表)

其他发行版,根据你的发行版安装:

步骤1

  • deb:libfontconfig1-dev(Debian、Ubuntu 等)
  • rpm: fontconfig-devel (Fedora, EPEL)
  • csw: fontconfig_dev (Solaris)
  • 冲泡:自由类型(OSX)

第2步

  • deb: libcairo2-dev (Debian, Ubuntu)
  • rpm: cairo-devel (Fedora, CentOS, RHEL)
  • csw: libcairo_dev (Solaris)
  • 酿造:开罗(OSX)
于 2021-01-27T16:19:44.373 回答