This was a question about python 2.7, but probably it will be useful to give an answer for the versions above 3.3 too:
Previously, multiple versions (also environments, also they are specific folders) of python on the same system was rare, and placing the only available python.exe directly in PATH was acceptable. Currently, multiple installed python versions will conflict and override each other if simply placed that way.
After 3.3 a python launcher was introduced which detects and activates one of the installed versions automatically. It is supposed to be placed in PATH instead of any python executable.
So in this modern situation, Get-Command python | fl * may give you nothing or nothing helpful.
And to run scripts or to get available versions, use launcher:
- ensure you have it:
try Get-Command py command from the PowerShell. If launcher is missing, it can be installed with the official installer. There is a separate checkbox for the launcher which is enabled by default.
- if install is correct, command
py --list-paths will give a summary on the installed versions, and supposed way to run scripts is not previous python main.py, but commands like py main.py or py -3.5 main.py. Run py --help for more info.
Additional confirmation that intended way changed.
Just to give an idea, launcher is not the only way to activate, this also can be done by a simple command.
For example, there is a version under D:\python_install\python.exe. But it's not in the PATH and python command correctly ends with not found error or opens Windows Store. An additional command in cmd or bat SET PATH=D:\python_install\;%PATH% or PowerShell $env:Path = "D:\python_install\;" + $env:Path temporarily activates that specific version, and python will work as previously during that specific run.