Miniconda安装python和r构建vscode-jupyter

引言:

就个人而言,首先本人更喜欢手动配置自己需要的东西,不想带一些不需要的包,多少有些洁癖,其次本人更喜欢一体化的去管理一个项目,miniconda正是我现在寻找的一项选择。本文仅供记录和参考

软件准备及安装

Miniconda的安装

Visual Studio Code的安装

Miniconda的安装python和R

# 创建一个虚拟环境并安装python和R指定版本和包
conda create -n data python=3.9 ipykernel conda-forge::r-base r-essentials
# ipykernel配置添加jupyter内核
python -m ipykernel install --user --name data
# 进入r解释器配置vscode的jupyter内核
R.exe
install.packages('IRkernel')
IRkernel::installspec()
# 为jupyter网页版添加python-lsp和R-lsp
conda install -c conda-forge python-lsp-server r-languageserver jupyterlab-lsp
# kernelspec配置删除内核
jupyter kernelspec list
jupyter kernelspec remove data

切换内核

打开一个*.ipynb文本文件

右上角显示选择内核点击

切换内核

配置Vscode

Setting.json文件配置

{
    "workbench.startupEditor": "none",
    "window.menuBarVisibility": "toggle",
    "window.commandCenter": false,
    "chat.commandCenter.enabled": false,
    "explorer.confirmDelete": false,
    "files.autoSave": "afterDelay",
    "update.mode": "none",
    "editor.fontSize": 18, // 字号
    "editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New'", // 字体
    "editor.lineNumbers": "relative", // 相对行号
    "editor.lineHeight": 27, // 行高
    "python.analysis.completeFunctionParens": true,  // 让它补全函数名时自动加括号
    "python.analysis.autoSearchPaths": true,  // 自动搜索项目路径下的库
    "terminal.integrated.defaultProfile.windows": "Windows PowerShell", // 配置终端   
    "editor.quickSuggestions": {
        "comments": "off",
        "strings": "off",
        "other": "on"
    },
    "editor.hover.enabled": false,
    "editor.parameterHints.enabled": false,
    "workbench.iconTheme": "vscode-jetbrains-icon-theme-2023-auto",
    "jupyter.askForKernelRestart": false,
    "workbench.activityBar.location": "bottom",
    "workbench.layoutControl.enabled": false,
    "explorer.confirmDragAndDrop": false,
    "breadcrumbs.enabled": false
}

必要插件安装

Python;


jupyter;

R;

美化插件

尽情享受吧!

posted @ 2024-12-17 23:05  泊尘畔  阅读(234)  评论(0)    收藏  举报