0

I have installed python using cmd on windows. My code was:

msiexec.exe /i python.msi /qb

This command pops the installer box and I can see that python is being installed. Even after the installation I can see the python idle on clicking on the windows button. But when i type python in the same cmd prompt or a new cmd prompt it shows

"python not recognized as internal or external command"

As I understand I need to add the path of python (If the problem is something else please share that as well). How to do it using cmd prompt?

And I don't want to open cmd as an administrator so except that is there any other solution possible.

Any help is appreciated.

Sunanda Saha
  • 53
  • 1
  • 6

1 Answers1

0

You simply use the PATH command. You also need to know the location of the Python installation. Once you do type in the following using semicolomn as separator:

setx PATH "<location to python>;%PATH%"

This will add the file path you specified to that file.

If you want to know if Python is already in PATH you simply use PATH and it lists everything under path.

As you correctly pointed out set is not permanent but setx is. See this page


The easier way to do it is to type in Cortana This PC. Right click and press Properties, next select Advanced system settings. In the new dialogue select Environment Variables, scroll down under system variables and click on Path. Select New and enter your new path. Finally press OK to confirm and your done.

Simon
  • 8,992
  • 8
  • 49
  • 76
  • But doesn't this solves my problem temporarily? Next time I try to run a python script from cmd prompt won't it show the same thing? As I read somewhere that this only sets the path for that console window. I want to save the path permanently. – Sunanda Saha Jan 10 '18 at 18:36
  • @SunandaSaha Edited – Simon Jan 10 '18 at 18:39
  • @SunandaSaha Happy to help. :-) – Simon Jan 10 '18 at 18:45