Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I type 'python' at the command line it says ''python' is not recognized as an internal or external command...'

I have Python in both User and System paths. In the past I have been able to run python from the command line, but suddenly today I can't.

I'm using Windows 7 32-bit.

Does anyone know what the problem could be?

Thanks

share|improve this question

migrated from stackoverflow.com Jun 23 '13 at 14:31

This question came from our site for professional and enthusiast programmers.

    
echo %PATH% What's the result? –  hbprotoss Jun 23 '13 at 9:48
    
C:\Python27;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTE‌​MROOT%\System32\WindowsPowerShell\v1.0\;Python27\Scripts;C:\OpenSSL-Win32; –  user2513306 Jun 23 '13 at 10:28

4 Answers 4

Lets assume that you installed python in the default location.

try adding this into your system environments.

name : PYTHONPATH
value: C:\Python27\;C:\Python27\Lib;C:\Python27\include;C:\Python27\DLLs;C:\Python27\Scripts;C:\Python27\Lib\site-packages

Note: when you create a PYTHONPATH environment variable it might effect some other application to forcefully use this version of python instead their own.

share|improve this answer
1  
PYTHONPATH won't help with finding the python.exe executable. –  Frank Osterfeld Jun 23 '13 at 12:43

The python install directory on Windows should have the following files (ignore the pyscopg and pillow files):

Python directory listing

Your PATH environment variable should be like the below if you have install Python2 at the default location:

PATH=%PATH%;C:\Python27\;C:\Python27\Scripts\

You should also have the following in PATHEXT:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

I noticed in your environment variables you have Python27\Scripts; which is not correct. Try fixing that, and you'll have to close any command prompts if you change any environment variables. If the settings are as the above and you still can't run Python, do a re-install.

share|improve this answer
    
Thanks, I've reinstalled Python now and it's working. –  user2513306 Jun 23 '13 at 10:59

This seems to be a problem in the PATH environment variable. To confirm that, in cmd try the following:

If you are using Python 2.7:

SET PATH=%PATH%;C:\Python27

If you are using Python 3.3:

SET PATH=%PATH%;C:\Python33

And then: python something

share|improve this answer
    
The output is the same ''python' is not recognized as an internal or external command...' –  user2513306 Jun 23 '13 at 10:23
    
could you check if you have python.exe inside this folder c:\Python27 –  Saullo Castro Jun 23 '13 at 10:40

python is clearly NOT in your PATH variable. You can confirm this by looking at the output of echo %path%.

Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.

Another possibility is that you added the wrong path to the PATH variable. Verify it.

The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.

share|improve this answer
    
I don't seem to have a python.exe file, only pythonw.exe. Is this the problem? It's not in my recycle bin so I haven't accidentally deleted it. –  user2513306 Jun 23 '13 at 10:16
    
I don't have a windows with me right now, but I'm pretty sure there should be a python.exe, and if you can't find it then something's wrong. Try to reinstall it. –  janos Jun 23 '13 at 10:25
    
thanks, I think I'll have to do that –  user2513306 Jun 23 '13 at 10:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.