Jupyter notebook 配置R(两种方案)顺带说明Error in IRkernel::installspec()

完整报错:

Error in IRkernel::installspec() : jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127. In addition: Warning message: running command '"jupyter" kernelspec --version' had status 127

Two options:

  • Find R.exe somewhere on your system and run this from the Anaconda prompt. Then you should be able to install IRkernel from your existing R environment.
  • Install R through conda. If I recall correctly, the command is conda install -c r r-irkernel. This is simpler because it lets conda manage everything, but it creates a separate R installation from the one Rstudio uses, which may be confusing.

从开发成员的描述来看就是说,一种自己从CRAN下载了R的安装包,去jupyter notebook配置R.

另一个是从Conda去下载。这种更简单(这个教程挺多,就不细说)

直接 

>  conda install -c r r-irkernel

你就可以直接使用R了,本人试了这个,不过当时没有指定版本,默认好像是R-3.x的版本,所以我install.packages下载library(readxl) 的时候,说版本过低,不能下载。

不过由于本人电脑之前已经从CRAN安装了R-4.x版本,所以执行conda install -c r r-irkernel,其实就是重新安装了个R,导致我这个R-4.x版本已经装了的library(readxl)用不了,所以就开始配置这个R-4.x。(当然,conda install -c r r-irkernel 应该是可以指定版本的,所以想怎么配置看个人吧)

就想用已经安装的R,所以要解决上面的Error in IRkernel::installspec()

本人装了几个conda的虚拟环境(不懂虚拟环境的就不用理),然后环境变量配置的是这个虚拟环境的路径,这是引出,Error in IRkernel::installspec()的关键原因,conda创建虚拟环境不会自动安装jupyter notebook.So, 通过conda install jupyter在虚拟环境也装上对应包.

所以,萌新或没有虚拟环境的,只需要去

环境变量配置conda的路径,指向./anaconda3/,然后进入你安装R文件夹下的bin目录,用管理员身份运行R.exe文件进入R语言,然后再次输入

> IRkernel::installspec(user = FALSE)

就ok了。

然后就

Happy coding!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值