无法使用 install_github() 安装 IRkernel:Git 未安装?

Cannot install IRkernel with install_github(): Git not installed?

我试图让 R 在我的 Windows 机器上使用 Jupyter Notebook。我跟着IRkernel tutorial。 但是,我无法安装 GitHub 存储库,我总是收到错误

install_github("IRkernel/IRkernel") Downloading GitHub repo IRkernel/IRkernel@master Error: Git does not seem to be installed on your system.

devtools 包 (2.0.1) 已安装。 install_github 也适用于 install_github("StatsWithR/statsr") (Coursera 包)(尽管甚至没有加载 devtools 包?)。

不确定如何处理这个问题,有什么想法吗?我的 devtools 包坏了吗?

更新: 刚刚重新安装了 R(删除了所有软件包):我仍然遇到同样的错误

这是解决这个问题的方法。我在我的 mac 中安装了带有 anaconda 的 IRkernel(我想在 Linux 和 Windows 上是一样的)我输入:

conda install -c r r-irkernel

然后我开始从终端输入 R:

R

最后,我安装了 kernelspec 以告诉 Jupyter 关于 IRkernel,在全局环境中安装选项 user=FALSE:

IRkernel::installspec(user=FALSE)

希望对您有所帮助!

以为我会在这里插话。我有同样的问题。我遇到了这个 post...https://github.com/IRkernel/IRkernel/issues/594 where Flying Sheep simply states to install git. So went to https://git-scm.com/ and downloaded and installed, then ran the instructions https://irkernel.github.io/installation/ 并且一切正常。现在在 Jupyter Nb 中使用 R。

我在 Windows 7 上遇到了同样的问题,发现旧版本的 devtools 包可以解决。 我从https://cran.r-project.org/src/contrib/Archive/devtools/下载了devtools_1.13.4.tar.gz(其他的没测试),做了如下操作:

  1. 从本地安装 devtools_1.13.4.tar.gz:

    进入 R,点击 Packages(在 R 控制台的顶部),然后点击 "Install package(s) from local zip files" 并安装 devtools_1.13.4.tar.gz,一条错误消息显示需要哪些依赖项,对我来说,消息是:

    错误:依赖项 'httr'、'memoise'、'whisker'、'digest'、'rstudioapi'、'jsonlite'、'git2r'、 'withr' 不适用于包 'devtools'。

  2. 安装这些依赖项:

    install.packages(c('httr', 'memoise', 'whisker', 'digest', 'rstudioapi', 'jsonlite', 'git2r', 'withr'))
    
  3. 从本地重新安装 devtools_1.13.4.tar.gz;
  4. 执行:

    library('devtools')
    install_github('IRkernel/IRkernel')
    IRkernel::installspec()
    

如果消息显示如下:

Error in IRkernel::installspec():jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127.

运行 R.exe 在 Anaconda 提示符下执行:

IRkernel::installspec()  

一切正常。

我结合了上面给出的两个解决方案并且对我有用,从 R 控制台 none 正在工作,现在它正在工作所以感谢上面的两个贡献者。

1- 进入 anaconda 提示符 运行conda install -c r r-irkernel

2- 现在在 anaconda 提示符下输入 R.exe

3- 现在 运行 这个命令 IRkernel::installspec()

它奏效了`

我怀疑 OP 链接的教程已更改

我按照 IRkernel 安装说明 here 时遇到同样的错误,但是:

install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()

尽管安装了 Git。

但使用以下作品:

install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
install.packages('IRkernel')
IRkernel::installspec()

(这些与现在 the tutorial linked to by the OP 上的说明相似。)