I type python
into the command line, but the command prompt says that python is not recognized as an internal or external command, operable program, or batch fi
It finally worked!!!
I needed to do things to get it to work
I had to add these to both for it to work.
If I added any subdirectories, it did not work for some reason.
Thank you all for your responses.
Seems like the python executable is not found in your PATH, which defines where it is looking for executables. See the official instructions for instructions on how to get the python executables in your PATH.
If you are working with command prompt and if you are facing the issue even after adding python path to system variable PATH.
Remember to restart the command prompt (cmde.exe).
Just go with the command py
. I'm running python 3.6.2 on windows 7 and it works just fine.
I removed all the python paths from the system directory and the paths don't show up when I run the command echo %path%
in cmd. Python is still working fine.
I ran into this by accidentally pressing enter while typing python
...
EDIT: I didn't mention that I installed python to a custom folder C:\Python\
Add the python bin directory to your computer's PATH variable. Its listed under Environment Variables in Computer Properties -> Advanced Settings in Windows 7. It should be the same for Windows 8.
Rather than the command "python", consider launching Python via the py launcher, as described in sg7's answer, which by runs your latest version of Python (or lets you select a specific version). The py launcher is enabled via a check box during installation (default: "on").
Nevertheless, you can still put the "python" command in your PATH, either at "first installation" or by "modifying" an existing installation.
First Installation:
Checking the "[x] Add Python x.y to PATH" box on the very first dialog. Here's how it looks in version 3.8:
This has the effect of adding the following to the PATH
variable:
C:\Users\...\AppData\Local\Programs\Python\Python38-32\Scripts\
C:\Users\...\AppData\Local\Programs\Python\Python38-32\
Modifying an Existing Installation:
Re-run your installer (e.g. in Downloads, python-3.8.4.exe) and Select "Modify". Check all the optional features you want (likely no changes), then click [Next]. Check [x] "Add Python to environment variables", and [Install].