方法1(最簡單)
- 將鏡像設為清華鏡像,這樣下的快,而且避免牆
options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
- 安裝
install.packages('IRkernel')
- 激活
IRkernel::installspec()
方法2(從github)
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()
但是使用github下載時,可能會出現編碼問題:
句法分析器24行里不能有多字節字符
編碼問題的話,在設置中設置code的默認編碼為中文,並運行以下命令:
Sys.setlocale("LC_ALL","Chinese")
或者牆的問題:
required package could not be found
無解。
方法3(本地)
先從github克隆過來(當然直接下載、解壓也行):
git clone https://github.com/IRkernel/IRkernel.git
進入該文件夾,注意要有setup。 在該文件夾中打開CMD,先build(),再install(),最后再去激活
IRkernel::installspec()
最后就可以在Jupyter中使用啦