cmd prompt does not recognizes python command on Windows 7

BartC bc at freeuk.com
Wed Aug 10 09:46:03 EDT 2016


On 10/08/2016 11:34, eryk sun wrote:
> On Wed, Aug 10, 2016 at 4:46 AM,  <sh.ajay12 at gmail.com> wrote:
>>
>> i have installed python 3.5 , but the python command is not recognized
>>
>> C:\Users\sharmaaj>python
>> 'python' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> what should i do to run python commands.
>
> Modify your setup. Open "Programs and Features" from the control
> panel. Right-click the entry for Python 3.5 (not "Python Launcher")
> and select Uninstall/Change. In the dialog, click on "Modify". Click
> "Next" and select "Add Python to environment variables". Click
> "Install". When it's done, open a new command prompt and enter
> "python".

That's an unusual way of doing it. And rather precarious as you're one 
wrong click away from deleting Python altogether!

It also, after doing the above, spent rather a long time copying files 
about when the operation shouldn't need anything of the sort.

However, I tried it and it didn't seem to work (opening a new prompt and 
type 'python'). Maybe it needs a machine restart, but I can't be 
bothered to try that on the off-chance it might work.

The method I use is this:

* Start Control Panel again

* Click System (assuming you have the 'classic' or 'icon' view otherwise 
you have to hunt for it)

* Click Advanced System Settings

* Click Environment Variables

* Highlight the "Path" variable in the top panel (User variables)

* Click Edit

* Being careful not to erase the whole lot (I hate when it highlights 
the whole thing, as the slightest false move and everything disappears), 
navigate to the front of the current settings, and type in (depending on 
where Python is installed):

    C:\Python\;

(Or navigate to the end and type ;C:\Python\, assuming there are some 
settings already.)

* Keep clicking OKs until it's done

* Open the command prompt again and type 'python' to test.

NOTE: I've assume Python is in C:\Python, but it might more typically be 
C:\Python34 etc. This way, you can choose which version to invoke if 
there are several.

-- 
Bartc



More information about the Python-list mailing list