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

相关推荐
Nightmare0042 天前
切换conda环境的时候输出zstandard could not be imported. Running without .conda support.
开发语言·python·conda
开发者小天2 天前
python中使用jupyter notebook 绘制正态分布直方图 密度图 小提琴图 模仿企鹅喙长分布图
开发语言·python·jupyter
墨染天姬2 天前
【AI】conda常用指令
人工智能·conda
SCBAiotAigc2 天前
2026.2.25:conda与uv并存时,如何取消base激活
人工智能·python·conda·uv
何伯特3 天前
ROS与Conda的兼容性问题深度解析与解决方案
conda·ros
Autumn72994 天前
【系统重装】PYTHON 入门——速通版
开发语言·python·conda·cuda
C系语言5 天前
Anaconda、conda环境命令
conda
Katecat996635 天前
【计算机视觉】基于Faster R-CNN的线段检测与分割实现
计算机视觉·r语言·cnn
天桥下的卖艺者6 天前
R语言使用trajeR包进行组轨迹模型分析(gbtm- group based trajectory models)
开发语言·r语言
cooldream20096 天前
Conda 报错 InvalidArchiveError 深度排查与彻底解决指南:从缓存损坏到环境重建的完整思路
缓存·conda