[Python] VScode does not use the correct Python interpreter

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

  1. Stack

    Stack Membro Participativo

    On ubuntu 24, I have installed anaconda and created a virtual environment myenv. I can see myenv when I search for a python interpreter with VScode, I select it, and in the dedicated terminal I activate the environment and check the python version

    conda activate myenv
    which python


    but when I click on the VS code to run code (the top right button with the arrow), it keeps using the link:

    /bin/python3


    I have tried the following json configurations in a local .vscode repo:

    .vscode/settings.json
    {
    "python.defaultInterpreterPath": "/home/path/anaconda3/envs/myenv/bin/python"
    }

    .vscode/launch.json
    {
    "version": "0.2.0",
    "configurations": [
    {
    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}"
    }
    ]
    }


    closing and reopening, none of these works. I am quite puzzled, given that python, virtual environment and VScode are quite standard tools, I expected it to be straightforward. Am I missing a point?

    Continue reading...

Compartilhe esta Página