Home > Software engineering >  Python default settings. PythonPath
Python default settings. PythonPath

Time:11-26

On a Python tutorial I'm following, the Python path is linked to the python.pythonPath setting in the settings.json file of Visual Studio Code. However, the python.pythonPath does not exist anymore.

I tried to find the python.pythonPath variable or alternatives in the default settings.json file, but I could not find one.

What is the alternative to this settings variable?

CodePudding user response:

Doesnt the python installer have an option to link itself to PATH? Im fairly sure i havent manually set it up for projects.

CodePudding user response:

According to the documentation on Github, the python.pythonPath setting is indeed not used anymore.

Instead, a new settings with the name python.defaultInterpreterPath has been introduced.

Note, however, that this setting is not exactly the same. The way it is processed by Visual Studio Code is changed as well. See the documentation linked above, or the Python settings reference:

python.defaultInterpreterPath:

Path to the default Python interpreter to be used by the Python extension on the first time it loads for a workspace, or the path to a folder containing the Python interpreter. Can use variables like ${workspaceFolder} and ${workspaceFolder}/.venv. Using a path to a folder allows anyone working with a project to create an environment in the .venv folder as appropriate to their operating system, rather than having to specify an exact platform-dependent path. The settings.json file can then be included in a source code repository.

Note: Changes to this setting made after an interpreter has been selected for a workspace will not be applied or considered by the Python extension. The Python extension doesn't automatically add or change this setting.

  • Related