This was a question about python 2.7, but probably will be useful to give an answer for versions above 3.3 too:
Previously, having multiple versions of python installed was rare and placing 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 runs required versions automatically. It is supposed to be placed in PATH
instead of specific python executable.
It is probably best now not to have any python.exe
avaliable by default, but to activate availability temporary. For example, you have one of many python versions under D:\python_install\python.exe
. In batch by default python
command correctly ends with not found error, but after additional command SET PATH=D:\python_install\;%PATH%
starts to work as previously.
So in this modern situation, Get-Command python | fl *
may give you nothing or nothing helpful.
And to run scripts or to get avaliable versions, use launcher:
- ensure you have it: test via
Get-Command py
command from PowerShell. If launcher is missing, ensure it with checkbox in official installer.
- if install is correct, command
py -0p --list-paths
will give good summary on installed versions, and supposed way to run scripts is not previous python main.py
, but commands like py -3.5 main.py
. Run py --help
for more info.
Additional confirmation that intended way changed.