Search code examples
pythonvisual-studio-codepython-extensions

How does VSCode's Python Extension use the Paths you set?


I'm troubleshooting an issue with VSCode's Python extension trying to load the wrong version of Python.

I'd like to know how this extension uses the Path variables you give it in its settings. For example, see the picture below:

Example of the Python extension's Path variables.

Intuitively, I assume it uses my environment variables and searches for the package in there, but does it?

I suppose another option is somehow using the interpreter path passed to it earlier:

Python extension's interpreter path.

How does the extension use this Path?


Solution

  • Have a look at VSCode's documentation in the Formatter Specific Settings section of Editing Code. I've copied in the relevant section below:

    Formatter Specific Settings section of VSCode's documentation.

    You can see that by default the Python extension looks for the formatter within the selected interpreter. So your second answer appear to be the correct one, although the documentation is not precise, so if anyone knows better, please correct me.