在Jupyter Notebook安装中使用R

问题描述

我已经从官方站点安装了R,并且想从jupyter笔记本和jupyterlab中使用它。为此,我使用以下命令在R中安装了IRkernal:

install.packages('IRkernel')

,然后当我键入IRkernel::installspec(user = FALSE)使该安装在全局可见时, 我收到以下错误

Error in IRkernel::installspec(user = FALSE) : 
  jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127.
In addition: Warning message:
In system2("jupyter",c("kernelspec","--version"),FALSE,FALSE) :
  '"jupyter"' not found

我在miniconda上安装了jupyter,并且我不想使用R的conda发行版。我该怎么办?

解决方法

用于设置IRkernel的命令必须在与jupyter安装相同的环境中运行。因此,它不能直接与R.exe一起使用。为此,您必须在Anaconda提示符下运行命令IRkernel::installspec(user=False)