将 brew installed openblas 链接到 /usr/local

Linking brew installed openblas to /usr/local

我安装了 R,然后安装 openblas - 但 没有 /usr/local :

==> openblas
openblas 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 openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

For pkg-config to find openblas you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

我对 openblas 的主要用例是 Rscipy。后者不再支持 Macos Accelerate 包:所以重定向到 brew 没有问题。无论如何,前者都会使用 brew:所以我认为这样做没有坏处。但是如何去做呢?

两个步骤完成了这项工作:

  • 通过 brew 卸载 openblas:

    brew uninstall --ignore-dependencies openblas

  • 重新安装R

    brew install R

  • 手动创建符号 link 到 /usr/local :

    sudo ln -s /usr/local/opt/openblas /usr/local

现在我们有 R !

$R

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin18.6.0 (64-bit)

 .. 

>