【问题标题】:Install specific version of R via homebrew通过自制软件安装特定版本的 R
【发布时间】:2019-11-12 11:10:20
【问题描述】:

我已经在 macOS 中从 Home-brew 安装了 R:

brew install R

不过,现在我需要切换版本并安装特定的 R 版本。出于这个原因,我尝试以两种方式安装 R-3.5.2,但均未成功:

brew install R-3.5.2
brew install R@3.5.2

这是我得到的:

Error: No available formula with the name "r@3.5.2" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

你有什么想法吗? 谢谢:)

【问题讨论】:

  • 如果你只需要这个来测试旧版本的东西,我会推荐rstudio.cloud
  • 感谢您的回答。我实际上需要降级并保留旧版本。
  • 虽然在技术上使用brew 可以实现,但您真正想要的是拥有虚拟环境。我建议在单独的环境中使用 conda 安装和管理 shell 级软件。
  • 我喜欢在 R-studio 工作。你认为虚拟环境与它兼容吗?顺便说一句,现在我宁愿将版本从最新版本切换到 3.5.2。你知道怎么做吗?
  • 没人?请!我需要安装这个旧版本:(

标签: r macos homebrew


【解决方案1】:

免责声明:我没有可用于测试的 Mac。

Here 你可以找到一个非常有用的关于如何通过自制软件安装旧版本的教程,here 是另一个。

对于 R,这转换为:

git clone https://github.com/Homebrew/homebrew-core.git
cd homebrew-core/
git log master -- Formula/r.rb

这会为 R 3.5.2 产生以下提交:

commit e66b3a288ee5e68c3c04e95705b7311c9f76bdf2
Author: ...
Date:   Sun Jan 13 10:59:16 2019 +0000

    r: update 3.5.2_2 bottle.

commit a2ced14fabb30732b2b6f22919105ac66085e78c
Author: ...
Date:   Tue Jan 8 10:36:41 2019 +0100

    r: revision for readline

commit 61c60b0c4c237a0ada3ab8b83b934566b101ee67
Author: ...
Date:   Sat Jan 5 04:06:37 2019 +0000

    r: update 3.5.2_1 bottle.

commit f9325e5e63ba812d1a2d5fd405811e313f782ff1
Author: ...
Date:   Fri Jan 4 17:36:34 2019 +0100

    r: build with openblas

commit 70aca0ac8f83459ff1ce18c1ea3f462b49434eb2
Author: ...
Date:   Fri Dec 21 06:48:02 2018 +0000

    r: update 3.5.2 bottle.

commit d344d5b57d0c8b0bf0ef6b3052e6bed551b37b47
Author: ...
Date:   Fri Dec 21 14:31:14 2018 +0800

    r 3.5.2

    Closes #35321.

作为替代方案,您可以通过 URL 搜索提交(请参阅this 评论):

https://github.com/Homebrew/homebrew-core/search?q=r%203.5.2&type=commits


因此,您应该能够通过(最新的 R 3.5.2 提交)安装 R 3.5.2:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e66b3a288ee5e68c3c04e95705b7311c9f76bdf2/Formula/r.rb

或:

brew install https://github.com/Homebrew/homebrew-core/raw/e66b3a2/Formula/r.rb

article 中提到的brew switch 和 brew pin 可能也很有趣。

【讨论】:

  • 非常感谢!我们就快到了。我终于能够按照您的指南安装 R 3.5.2。我还按照你的建议使用了 brew switch 和 brew pin。唯一的问题是,现在由于某些原因我无法使用它。这是错误:dyld:未加载库:/usr/local/opt/openblas/lib/libopenblasp-r0.3.5.dylib 引用自:/usr/local/Cellar/r/3.5.2_2/lib/R/lib /libR.dylib 原因:找不到图像 中止陷阱:6
  • This 可能会有所帮助。
猜你喜欢
  • 2020-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-03
  • 2023-01-04
  • 2022-01-17
  • 1970-01-01
相关资源
最近更新 更多