Making VS Code and Python Play Nice on Windows

One of the editors I use regularly is VS Code. I work a lot with Python, but when installing Anaconda using default settings on a Windows machine already having VSC installed there’s a good chance you’ll run into an issue. When attempting to run Python code straight from VSC you may get an error. This should be fixed on some newer versions of Anaconda, but I’ve needed to do something about it often enough I feel it’s useful to save the solution janh posted on StackExchange.

Specifically, the issue can be fixed by manually changing VSC’s default shell from PowerShell to CMD. Just open the command palette (CTRL+SHIFT+P), search “Terminal: Select Default Profile” and switch to “Command Prompt”. Everything should work as expected from now on!

D. Michael Senter
D. Michael Senter
Research Statistician Developer

My research interests include data analytics and missing data.

Related