Adding Python to PATH on Windows

Viewed 545896

I've been trying to add the Python path to the command line on Windows, yet no matter the method I try, nothing seems to work. I've used the set command, I've tried adding it through the Edit Environment Variables prompt, etc.

Furthermore, if I run the set command on the command line it lists this.

python = c:\python27

Yet it still doesn't recognize the Python command.

Reading the documentation, and various other sources haven't seemed to help.

Just to clarify further, I've appended the path of the Python executable to PATH in the Edit Environment prompt. Doesn't seem to work.

22 Answers

I just installed Python 3.3 on Windows 7 using the option "add python to PATH".

In PATH variable, the installer automatically added a final backslash: C:\Python33\ and so it did not work on command prompt (i tried closing/opening the prompt several times)

I removed the final backslash and then it worked: C:\Python33

Thanks Ram Narasimhan for your tip #4 !

For people getting the windows store window when writing python in the console, all you have to do is go to configuration -> Manage app execution aliases and disable the toggles that say python.

then, add the following folders to the PATH.

C:\Users\alber\AppData\Local\Programs\Python\Python39\
C:\Users\alber\AppData\Local\Programs\Python\Python39\Scripts\

write that on your Command Prompt:

set Path=%path%

Replace %path% by the Path of your Python Folder Example:

set Path=C:/Python27

If you are on Windows, run this:

C:\Users\username> cd C:\bin
C:\bin> echo @php "%~dp0phpunit.phar" %* > phpunit.cmd

Make sure, you have installed phpuunit as stated here: https://phpunit.de/manual/6.5/en/installation.html

Then:

phpunit path-to-your-test

For an anaconda3 installation the paths to add are:

%USERPROFILE%\anaconda3\
%USERPROFILE%\anaconda3\Scripts\
%USERPROFILE%\anaconda3\Library\bin\

If you have got frustrated by setting the path for the python just download the new version of python uninstall the older version of the python and while installing the new version it will ask whether to set path mark that and install

its the best way

Related