cmd prompt does not recognizes python command on Windows 7

BartC bc at freeuk.com
Wed Aug 10 13:13:53 EDT 2016


On 10/08/2016 15:03, Random832 wrote:
> On Wed, Aug 10, 2016, at 06: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".
>
> Or he could just use "py", which is the python launcher you just
> mentioned, and works fine. If he has other versions of python installed
> he may need "py -3".

That works on my machine and I wondered why.

It seems to do it by simply putting a special executable (py.exe) into 
C:\windows, which is the first (or second) place it will look when 
someone types the name of a program.

But a bit of a cheat I think, and probably not good practice (suppose 
all your hundreds of apps put dedicated launchers into C:\windows which 
is supposed to be for OS stuff).

(And if you're going to do that, you can also just put a one-line script 
in there to launch any program.)

-- 
Bartc




More information about the Python-list mailing list