I Tried installing it multiple times, deleting it, watching tutorials, nothing is helping.
windows 10 - 'Python not found' despite having been installed - Stack Overflow
environment variables - 'py' works but not 'python' in command prompt for windows 10 - Stack Overflow
Python works, "py" doesn't
Python: command not found
Videos
I have installed the latest Python for Win10 from Releases for Windows.
Just typing py in the Command Prompt Window starts Python.
Microsoft Windows [Version 10.0.15048]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\sg7>py
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>`enter code here`
Testing:
>>> print("hello!")
hello!
>>>
Please be aware that in my case Python was installed in C:\Users\sg7\AppData\Local\Programs\Python\Python36> directory
C:\Users\sg7\AppData\Local\Programs\Python\Python36>dir
Volume in drive C is Windows7_OS
Volume Serial Number is 1226-12D1
Directory of C:\Users\sg7\AppData\Local\Programs\Python\Python36
08/05/2018 07:38 AM <DIR> .
08/05/2018 07:38 AM <DIR> ..
12/18/2017 09:12 AM <DIR> DLLs
12/18/2017 09:12 AM <DIR> Doc
12/18/2017 09:12 AM <DIR> include
12/18/2017 09:12 AM <DIR> Lib
12/18/2017 09:12 AM <DIR> libs
10/03/2017 07:17 PM 30,334 LICENSE.txt
10/03/2017 07:17 PM 362,094 NEWS.txt
10/03/2017 07:15 PM 100,504 python.exe
10/03/2017 07:12 PM 58,520 python3.dll
10/03/2017 07:12 PM 3,610,776 python36.dll
10/03/2017 07:15 PM 98,968 pythonw.exe
08/05/2018 07:38 AM 196,096 Removescons.exe
08/05/2018 07:38 AM 26,563 scons-wininst.log
08/05/2018 07:38 AM <DIR> Scripts
12/18/2017 09:12 AM <DIR> tcl
12/18/2017 09:12 AM <DIR> Tools
06/09/2016 11:53 PM 87,888 vcruntime140.dll
9 File(s) 4,571,743 bytes
10 Dir(s) 20,228,898,816 bytes free
When I am at C:\Users\sg7> directory level python can be invoked by typing
AppData\Local\Programs\Python\Python36\python
C:\Users\samg>AppData\Local\Programs\Python\Python36\python
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Newer Python 3.7 will be installed at:
C:\Users\YourUserNameHere\AppData\Local\Programs\Python\Python37
If you wish you can add to your path environment variable:
%USERPROFILE%\AppData\Local\Programs\Python\Python36
It finally worked!!!
I needed to do things to get it to work
- Add C:\Python27\ to the end of the PATH system variable
- Add C:\Python27\ to the end of the PYTHONPATH system variable
I had to add these to both for it to work.
If I added any subdirectories, it did not work for some reason.
Thank you all for your responses.
I had the same issue, it happed that i just had go to Windows settings and search for manage app Execution Aliases.
I had both python and python3 installed, so I turned off the one I didn't want to use. Then it worked fine. Seems like the both were under same name "App installer"

NOTE:
Comment from here
The python.exe and python3.exe app execution aliases are part of the
Microsoft.DesktopAppInstallerUWP app. This application cannot be removed (the AppX package'sNonRemovableproperty is true). Removing thepython.exeandpython3.exefiles (actually NTFS reparse points) from%LOCALAPPDATA%\Microsoft\WindowsAppsis functionally equivalent to toggling the app execution alias in the Settings app. Unfortunately, their removal is not noticed by the Settings app, as it uses its own persistence (viaWindows.StateRepositoryPS.dll) to keep track of the toggle state.
I am pretty new to visual studio code and I tried to follow all of the advice with absolutely no luck.
I had uninstalled python and reinstalled and was about to give up. Then I uninstalled and when I reinstalled I noticed at the beginning of installer ADD TO PATHwith a tick box there. I ticked it, installed, restarted and wallah Everything worked like it should.
So simple and so hard to get there!!!!!!
As suggested in comments, you could create an alias as follows:
alias python='python3'
by adding it to the ~/.bashrc file at the end of this file, exiting and reloading it in the current terminal using the next command: . ~/.bashrc
Or using linking:
As you can see below, my python points to python2, python2 points to python2.7.
To achieve the same, use:
sudo ln -s /usr/bin/python2.7 /usr/bin/python2
sudo ln -s /usr/bin/python2 /usr/bin/python
If you want python pointing to 3rd version, you could use the same, but the last command should be:
sudo ln -s /usr/bin/python3 /usr/bin/python
Example
$ whereis python
python: /usr/bin/python3.7 /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python3.7m-config /usr/bin/python3.7-config /usr/bin/python /usr/bin/python3.7m /usr/lib/python3.7 /usr/lib/python2.7 /usr/lib/python3.8 /etc/python3.7 /etc/python2.7 /etc/python /usr/local/lib/python3.7 /usr/local/lib/python2.7 /usr/include/python3.7 /usr/include/python2.7 /usr/include/python3.7m /usr/share/python /usr/share/man/man1/python.1.gz
user@lenovo:~$ ls -ailh /usr/bin/python*
1446954 lrwxrwxrwx 1 root root 7 жов 10 14:32 /usr/bin/python -> python2
1446952 lrwxrwxrwx 1 root root 9 жов 10 14:32 /usr/bin/python2 -> python2.7
1465834 -rwxr-xr-x 1 root root 3,6M лис 7 12:07 /usr/bin/python2.7
1447155 lrwxrwxrwx 1 root root 33 лис 7 12:07 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
1447156 lrwxrwxrwx 1 root root 16 жов 10 14:32 /usr/bin/python2-config -> python2.7-config
1442842 lrwxrwxrwx 1 root root 9 лют 12 00:23 /usr/bin/python3 -> python3.7
1449245 -rwxr-xr-x 2 root root 4,9M лис 20 11:21 /usr/bin/python3.7
1447339 lrwxrwxrwx 1 root root 33 ли 20 11:21 /usr/bin/python3.7-config -> x86_64-linux-gnu-python3.7-config
1449245 -rwxr-xr-x 2 root root 4,9M лис 20 11:21 /usr/bin/python3.7m
1447340 lrwxrwxrwx 1 root root 34 лис 20 11:21 /usr/bin/python3.7m-config -> x86_64-linux-gnu-python3.7m-config
1447341 lrwxrwxrwx 1 root root 16 жов 2 15:31 /usr/bin/python3-config -> python3.7-config
1442843 -rwxr-xr-x 1 root root 384 січ 30 2019 /usr/bin/python3-futurize
1442847 lrwxrwxrwx 1 root root 10 лют 12 00:23 /usr/bin/python3m -> python3.7m
1447342 lrwxrwxrwx 1 root root 17 жов 2 15:31 /usr/bin/python3m-config -> python3.7m-config
1442844 -rwxr-xr-x 1 root root 388 січ 30 2019 /usr/bin/python3-pasteurize
1447157 lrwxrwxrwx 1 root root 14 жов 10 14:32 /usr/bin/python-config -> python2-config
1455649 lrwxrwxrwx 1 root root 58 лип 10 2019 /usr/bin/pythontex -> ../share/texlive/texmf-dist/scripts/pythontex/pythontex.py
1450999 -rwxr-xr-x 1 root root 306 лип 10 2019 /usr/bin/pythontex3
For managing python3 versions, you can use python alternatives to create symbolic links:
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
And choose which one to use as using the command:
$ sudo update-alternatives --config python3
For managing python2 and python3 using update-alternatives, you could see in michael's answer.
This solution only applies to Ubuntu 20.04 (but sometimes people look at "similar issues" for a solution).
In the case you like python to refer to python3, you can simply install python-is-python3:
sudo apt-get install python-is-python3
After this, invoking python will work just fine.
py is itself located in C:\Windows (which is always part of the PATH), which is why you find it. When you installed Python, you didn't check the box to add it to your PATH, which is why it isn't there. In general, it's best to use the Windows Python Launcher, py.exe anyway, so this is no big deal. Just use py for launching consistently, and stuff will just work. Similarly, if py.exe was associated with the .py extension at installation time, a standard shebang line (details in PEP linked above) will let you run the script without even typing py.
I don't know precisely what VSCode uses to find Python (using py.exe directly, using a copy of Python that ships with the editor, performing registry lookup, a config file that just says where to find it, etc.), but that's not really relevant to running your scripts yourself.
You could try execute in cmd:
where py
Output will be paths to the executable. E.g:
C:\Users\user>where python
C:\Users\user\Anaconda3\python.exe
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe
This helps you track down, which one is executed.
One can run the python installer again and click Modify button.

Select py launcher checkbox.

Then click install button and wait for the installation completes.
After all of these, py command will come back to the terminal.
Run in the command line:
doskey py = python
This creates an alias for the python command and then you can use py to start the python interpreter.
If you get an error regarding doskey not being recognized as an internal or external command, add C:\Windows\System32; to the PATH and run the command again. You can follow the more detailed instructions here to modify the PATH.
I'm running a windows 10 machine with Python 3.12 installed. For some reason the 'python' command works fine, but 'py' gets me "'py' is not recognized as an internal or external command, operable program or batch file."
I have python installed here: C:\Users[username]\AppData\Local\Programs\Python\Python312
And the python launcher installed here: C:\Windows\py.exe
I've added both locations to my PATH, restarted the machine, but still doesn't work.
Any help is appreciated.
When trying to run a python script, the error:
line 7: python: command not found
pops up every time. I reinstalled Python and when running the command: type -a python to check if python is installed I get "python not found". No programs run anymore. Is there a fix for that?
Thanks!