[Python] Configuring VSCode Studio to auto select a conda kernel for all notebooks in a...

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to configure VSCode to remember the Conda kernel for an entire repository so that I do not have to select the kernel every time I open a python Jupyter notebook in VSCode.

    In this example, my conda kernel is named geotgr when I print jupyter kernelspec list. I made a workspace configuration file named .vscode/settings.json in my repository:

    {
    "python.defaultInterpreterPath": "${env:CONDA_PREFIX}/bin/python",
    "python.analysis.extraPaths": ["${env:CONDA_PREFIX}/lib/python3.12/site-packages"],
    "jupyter.jupyterServerType": "local",
    "jupyter.defaultKernel": "geotgr",
    "jupyter.kernels.default": "geotgr",
    "jupyter.kernels.exclude": [
    "Python 2",
    "Python 3"
    ]
    }


    Despite this, when I open the Notebook.ipynb file, it does not remember and pick the kernel. I also tried an absolute file path which did not work.

    "python.defaultInterpreterPath": "/home/darkknight/anaconda3/envs/geotgr/bin/",
    "python.analysis.extraPaths": ["/home/darkknight/anaconda3/envs/geotgr/lib/python3.12/site-packages"]

    Continue reading...

Compartilhe esta Página