![](/img/trans.png)
[英]Using R after using migration assistant to move from Intel to Apple Silicon M1 returns errors: Bad CPU type in executable and Undefined error: 0
[英]Resolve issues installing R packages after switch from Intel to apple silicon
我剛剛將舊 Mac 遷移到新 Mac(Intel 到 Apple Silicon),安裝了最新版本的 R,運行brew upgrade
,並開始更新 R 軟件包。 許多需要重新安裝,有些來自源代碼。 我遇到了幾個問題。
我真的不想解決每個庫問題。 我覺得~/.R/Makevars
和~/.Rprofile
可能需要編輯。 我需要做什么才能解決這些問題 go?
一些資源很有幫助,但有些資源似乎已過時或不完整。 這是我嘗試對我認為有效的方法進行完整的逐步重現,我將在啟動和運行新系統時根據需要進行編輯。
主要基於此處的建議,我按如下方式編輯了 Makevars 文件:
在 shell 中:
vi ~/.R/Makevars
然后我點擊i
(用於插入)並刪除了那里的所有內容。 然后我補充說:
LDFLAGS += -L/opt/homebrew/opt/libomp/lib
CPPFLAGS += -I/opt/homebrew/opt/libomp/include
FLIBS =-L/opt/homebrew/opt/gfortran/lib
F77 = /opt/homebrew/bin/gfortran
FC = /opt/homebrew/bin/gfortran
CFLAGS = -I/opt/homebrew/include
CPPFLAGS = -I/opt/homebrew/include
CXXFLAGS = -I/opt/homebrew/include
為了保存,我按了esc
,然后按:x
保存並關閉。
AFAIK,這解決了庫查找/加載/鏈接的問題,我現在已經從源代碼安裝了幾個包,沒有錯誤。
為了處理煩人的彈出式 GUI window 到 select CRAN 鏡像,我編輯了~/.Rprofile
(也如上所述使用vi
)來閱讀:
local({r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org"
options(repos=r)
})
options(menu.graphics = FALSE)
這是基於對這個古老但仍然重要的問題的最佳答案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.