"python" not recognized as a command
python, windows
Solution
You need to add the python executable path to your Window's PATH variable.
- From the desktop, right-click My Computer and click Properties.
- In the System Properties window, click on the Advanced tab.
- In the Advanced section, click the Environment Variables button.
- Highlight the Path variable in the Systems Variable section and click the Edit button.
- Add the path of your python executable(`c:\Python27\`). Each different directory is separated with a semicolon. (Note: do not put spaces between elements in the `PATH`. Your addition to the `PATH` should read `;c:\Python27` NOT `; C\Python27`)
- Apply the changes. You might need to restart your system, though simply restarting `cmd.exe` should be sufficient.
- Launch cmd and try again. It should work.
Problem
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a `cmd` window and type `python` I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at `C:\Python27\`. Prior to Windows 10 and Python 3.7, this problem would cause Python not to be found at all. However, nowadays on up-to-date systems, it will instead result in an offer from Microsoft to install Python from the Microsoft Store. Users who already installed Python themselves from python.org ordinarily should not also get the Microsoft version; the offer is made to try to help users who are not computer-literate enough to do it themselves, and there can be conflicts between how the two versions are set up. At best, it is redundant and normally not useful. Please see CMD opens Windows Store when I type 'python' for details on the up-to-date version of the problem.