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
Another helpful but simple solution might be restarting your computer after doing the download if Python is in the PATH variable. This has been a mistake I usually make when downloading Python onto a new machine.
After restarting my machine then Windows will often recognize Python in the PATH variable.
I had the same problem for a long time. I just managed to resolve it.
So, you need to select your Path, like the others said above. What I did:
Open a command window. Write set path=C:\Python24 (put the location and the version for your python). Now type python, It should work.
The annoying part with this is that you have to type it every time you open the CMD.
I tried to do the permanent one (with the changes in the Environmental variables) but for me its not working.
Further to @Udi post this is what the script tried to do, but did not work with me.
I had to the set the following in the PATH
nothing else.
C:\Users\hUTBER\AppData\Local\Programs\Python\Python35
C:\Users\hUTBER\AppData\Local\Programs\Python\Python35\Scripts
Were mine and now python
works in the cmd
You need to add the python executable path to your Window's PATH variable.
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
)cmd.exe
should be sufficient.emphasis: Remember to always RESTART the CMD WINDOW after setting the PATH environmental variable for it to take effect!
You can do it in python installer: