Search code examples
pythonvisual-studio-codeworkspace

How to display multiple python interpreters in vscode


I am struggling finding a way for vscode to see my various Python interpreters, aside from the ones located in /usr/local/bin and /usr/bin.

I am using a macbook and my issue is with my created Python venv, located at /Users/<username>/pyenv/[.inienv, .mlnenv, etc.].

How can I set my workspace to look for python interpreters in other locations than the workspace itself?

There is no issue if I open vscode through the terminal by navigating to the folder containing the venv and executing code ..

VSCode docs say that the editor will look for a file named .env where you can specify environment variables, which I understand as I can set PYTHONPATH here. But, this is not working.

Link to Microsoft VSCode documentations


Solution

  • Add the following setting in settings.json:

        "python.venvPath": "/Users/<username>/pyenv",
    

    Explanation of this setting:

    Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).