devtools::install_github
虽然好用,但是有时候R不能与github通讯时就很尴尬。
在jupyter中使用R时需要安装IRkernel包:
1 | devtools::install_github('IRkernel/IRkernel') |
但是网络似乎出现了问题,but浏览器中还是可以访问这个repo的:
这时候可以考虑把repo克隆到本地后再离线安装。过程如下:
下载源码:
1
2
3
4
5
6
7
8$ git clone https://github.com/IRkernel/IRkernel.git
Cloning into 'IRkernel'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 2359 (delta 3), reused 4 (delta 1), pack-reused 2347
Receiving objects: 100% (2359/2359), 694.02 KiB | 30.00 KiB/s, done.
Resolving deltas: 100% (1401/1401), done.编译:需要用到命令行编译,如果git bash中能够检测到R可以直接在git bash中编译和安装
1
2$ which R
/d/Program/R/R-4.0.2/bin/R1
2
3
4
5
6
7
8
9
10$ R CMD build IRkernel
* checking for file 'IRkernel/DESCRIPTION' ... OK
* preparing 'IRkernel':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
Removed empty directory 'IRkernel/example-notebooks'
Removed empty directory 'IRkernel/tests/testthat/jkt'
Removed empty directory 'IRkernel/tests/testthat/njr'
* building 'IRkernel_1.1.1.9000.tar.gz'编译会生成一个以 .tar.gz 结尾的压缩包,安装它即可。
安装:需要用到命令行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28$ R CMD INSTALL IRkernel_1.1.1.9000.tar.gz
* installing to library 'D:/Program/R/R-4.0.2/library'
* installing *source* package 'IRkernel' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'IRkernel'
finding HTML links ... ▒▒▒▒
Comm-class html
CommManager-class html
IRkernel-package html
comm_manager html
installspec html
log html
main html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (IRkernel)
Making 'packages.html' ... ▒▒▒▒