VSCode: The term 'python' is not recognized...but py works

The Windows installer for Python does not put python on your path by default (there's a checkbox during installation to add it). Make sure that you selected an interpreter that's installed by running Select Interpreter and choosing the interpreter you want (the extension will find them through the registry).


It turned out that I just had to restart my computer after I installed ms-python.python and tht13.python and formulahendry.code-runner extensions on the VS Code and added python's Scripts folder in PATH.

Now both py and python commands work from anywhere like cmd or Run Code in the right click menu.


I also had this problem after a fresh Windows reinstallation, vscode didnt recognize the commands like python or pip freeze in the PS terminal.

After reinstalling python and vscode, I read the tutorial for python for vscode: https://code.visualstudio.com/docs/python/python-tutorial. Creating a new venv worked for me py -3 -m venv .venv, then navigate to the venv: .venv\scripts\activate. In the new venv all the python commands worked as normal.


Restarting your PC after installing the Python Extension and changing the PATH to include Python and it's scripts folder will help. Worked for me