"python" not recognized as a command
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 thePATH
. Your addition to thePATH
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.
This is because the Python exec are not in the search path of your operating system. In windows, start CMD. Type in
setx PATH PythonPath
where PythonPath is usually C:\Python27
or C:\Python33
or C:\Users\<Your User Name>\AppData\Local\Programs\Python\Python37
depending on your Python version. After restarting the CMD, you should get see outcomes when typing
Python --version
Python comes with a small utility that fixes this. From the command line run:
c:\python27\tools\scripts\win_add2path.py
Make sure you close the command window (with exit
or the close button) and open it again.