Search code examples
pythonvisual-studio-codecmdterminalanaconda

Visual Studio Code: How to choose cmd terminal for execution of Python files


I would like to run my Python files and projects in the integrated cmd terminal of VS Code (I am using version 1.60.0) in combination with my Anaconda environment.

For this purpose, I already set the Anaconda environment as the default Python interpreter and changed the default profile in the global user settings of VS Code to use cmd terminals by default. If I click on 'New Terminal' (the plus button in the integrated terminal section) it works as expected and my Anaconda environment is automatically activated in a new cmd terminal. However, everytime I use the 'Run Python File' or 'Debug Python File' buttons, VS Code opens up a new PowerShell terminal and tries to run the Python file there.

I can find no way of changing this behaviour to use the cmd terminal instead. Any help is greatly appreciated! Many thanks in advance.

EDIT: To clarify the desired behaviour that I would like to achieve: I would like to be able to press the "Run Python file in terminal" button and have the file being executed in the cmd line automatically. Instead VS Code opens a new PowerShell and tries to run the Python file there.

EDIT 2: As pointed out in the linked pages I tried setting the terminal.integrated.shell.windows setting. However, VS Code tells me that this setting is deprecated. Following the instruction about how to update the settings I changed the settings to the new nomenclature, which did not solve my issue either.

settings.json file


Solution

  • This is a bug in v1.60.0 and it will be fixed in next release.

    See bug report: Python extension does not honor default terminal type