Conda安装R环境并在Jupyter Lab中运行

说明:

Conda 安装 R 环境,并在 Jupyter Lab 中运行 R 脚本。

1. 创建环境并安装r-base

创建环境:conda create -n [环境名]
激活环境:conda activate [环境名]
安装 Jupyter Lab:conda install -c conda-forge jupyterlab
安装r-base:conda install r-base=4.4.1(R版本为4.4.1)

2. 安装 R 内核

进入 R 交互环境后,安装:
安装必要的包:install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
安装 IRkernel: install.packages("IRkernel")
Jupyter Lab 连接 IRkernel:IRkernel::installspec()
修改Jupyter Lab中显示的R环境名称:
jupyter kernelspec list 列出所有内核,找到 [环境名] 对应的 json 文件,修改其中的"display_name": "待显示的环境名称"

显示的默认环境名称为R

修改 json 后环境的名称:

参考:

1. https://blog.csdn.net/weixin_45348389/article/details/108359814

2. https://blog.csdn.net/guoyuzhu_2013/article/details/106604447

相关推荐
天桥下的卖艺者2 天前
chrals.CTI函数升级版发布,增加了CTI衍生的脂肪指数提取
数据库·r语言
Είναι η κοπέλα2 天前
Python 虚拟环境:venv、conda 与 Python 版本选择全解
开发语言·python·conda
程序员清风2 天前
Python 数据分析环境搭建:从 Jupyter 到 pandas
python·jupyter·数据分析
小师兄吃牛肉3 天前
什么是R语言?如何快速学习R语言
开发语言·学习·r语言
喆星时瑜3 天前
Win10/11 安装 R 与 RStudio 详细图文教程
开发语言·r语言·安装
oooost4 天前
Jupyter Notebook 常用快捷键速查
ide·python·jupyter
喆星时瑜4 天前
R语言基础语法入门
开发语言·r语言
喆星时瑜4 天前
R语言向量语法的详细教程
开发语言·r语言
开开心心_Every4 天前
文件夹批量创建工具支持同级和多层级
运维·服务器·游戏·jupyter·智能手机·pdf·postman
夏天拐跑了西瓜4 天前
一文入门LangChain:从框架认知到构建你的第一个AI Agent
python·langchain·conda·agent