pythonvisual-studio-codevirtualenv

How to change "Recommended environment" in Visual Studio Code


In Visual Studio Code, whenever I'm prompted to choose an environment, there is a "recommended" one or "favourite" one. But it's not the one I would like to see there (I would like another virtual environment* to get there).

E.g.: enter image description here

I've looked everywhere. How can I change this and select which one should be "recommended"?

* added virtual environment to this sentence because apparently someone said it's bad to recommend a non-virtual-environment


Solution

  • There are (at least) two things to change to have a menu like this:

    enter image description here

    1. activate your virtualenv first, and then launch code from the same shell.
        source ./venv/bin/activate
        code .
    
    1. Preferences->Extensions->Python:
        "python.defaultInterpreterPath": "/usr/bin/python"