dyld:未加载库:/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib

Kam*_*ski 7 homebrew r openblas

当我跑步时,R我得到:

dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
  Referenced from: /usr/local/Cellar/r/3.5.0_1/lib/libR.dylib
  Reason: image not found
Abort trap: 6
Run Code Online (Sandbox Code Playgroud)

确实文件不存在:

ls /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
ls: cannot access '/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib': No such file or directory
Run Code Online (Sandbox Code Playgroud)

我在macOS 10.13.3上并使用自制软件安装R,如下所示:

# Java
brew cask install java

# OpenBLAS (installs gcc and other dependencies)
brew install openblas

# R language for statistical computing
brew install r --with-openblas --with-java

# Install XQuartz, needed for R package "Cairo"
brew cask install xquartz

# Needed for R package "RMySQL"
brew install mariadb-connector-c

# Needed for R packages: udunits2, units, ggforce
brew install udunits
Run Code Online (Sandbox Code Playgroud)

Kam*_*ski 13

让我们看看安装的版本是否openblas为0.2.20:

brew info openblas 

openblas: stable 0.3.0 (bottled), HEAD [keg-only]
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.0 (22 files, 139MB)
  Poured from bottle on 2018-05-31 at 20:42:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ?
==> Options
--with-openmp
        Enable parallel computations with OpenMP
--HEAD
        Install HEAD version
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openblas/lib
    CPPFLAGS: -I/usr/local/opt/openblas/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/openblas/lib/pkgconfig
Run Code Online (Sandbox Code Playgroud)

我们有0.3.0,但R正在寻找0.2.20

要解决此问题,我们可以从已安装的dylib创建符号链接:

ln -s /usr/local/opt/openblas/lib/libopenblas.dylib \
      /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
Run Code Online (Sandbox Code Playgroud)

有用!

R

R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.4.0 (64-bit)
Run Code Online (Sandbox Code Playgroud)


小智 6

另一种解决方案是简单地重新安装 R:

brew reinstall r
Run Code Online (Sandbox Code Playgroud)

这将根据正确的库重新链接 R,并且您不会有任何可能成为孤立的或稍后导致问题的符号链接。这不会影响您已经安装的任何 R 包。此外,如果您已经使用 brew 安装了最新版本的 R 并且瓶子仍在您的计算机上,那么您将不必再次下载瓶子。