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

Answer from sg7 on Stack Overflow
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.14.6 documentation
To install the file downloaded from python.org, either double-click and select “Install”, or run Add-AppxPackage <path to MSIX> in Windows Powershell. After installation, the python, py, and pymanager commands should be available. If you have existing installations of Python, or you have modified your PATH variable, you may need to remove them or undo the modifications. See Troubleshooting for more help with fixing non-working commands.
Top answer
1 of 16
145

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

2 of 16
109

It finally worked!!!

I needed to do things to get it to work

  1. Add C:\Python27\ to the end of the PATH system variable
  2. 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.

Discussions

environment variables - 'py' works but not 'python' in command prompt for windows 10 - Stack Overflow
I installed Python on my computer. When I type python in the command prompt I get the following message: 'python' is not recognized as an internal or external command, operable program or batch fil... More on stackoverflow.com
🌐 stackoverflow.com
Python command not working (Windows 10)
It seems you may have included a screenshot of code in your post " Python command not working (Windows 10) ". If so, note that posting screenshots of code is against r/learnprogramming 's Posting Guidelines (section Formatting Code): please edit your post to use one of the approved ways of formatting code . (Do NOT repost your question! Just edit it.) If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images. Please, do not contact the moderators about this message. Your post is still visible to everyone. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
7
1
September 17, 2020
python script does not run from commandline
On an old windows7 machine, I did a test "associate .py to python.exe, and then rename python.exe to some else, and type *.py at command line", a pop-up window asking right executable file shows up; but on windows 10 command prompt, it simply do nothing. More on answers.microsoft.com
🌐 answers.microsoft.com
6
67
February 11, 2020
The Python executable is not recognized on Windows 10 - Stack Overflow
If not, create a new variable with Variable Name as Path and value as the copied path · Once you do that, close the window and simply open cmd. Type python and you should get something like this: ... If you are working with the command prompt and if you are facing the issue even after adding ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Reddit
reddit.com › r/learnprogramming › python command not working (windows 10)
r/learnprogramming on Reddit: Python command not working (Windows 10)
September 17, 2020 -

I have installed python 3.8.5. During installation, I selected the option to add python to system PATH. So in User Variables -> Path there is:

  • C:\Users\myname\AppData\Local\Programs\Python\Python38

  • C:\Users\myname\AppData\Local\Programs\Python\Python38\Scripts

I also added the above addresses to System Variables -> Path. If I type "py" into console, python console opens up. However, if I type "python", nothing happens. How can I resolve this so that when I type "python", it will act as if I typed "py"?

Console screenshot: https://imgur.com/ZRyIuN6

Top answer
1 of 3
1
It seems you may have included a screenshot of code in your post " Python command not working (Windows 10) ". If so, note that posting screenshots of code is against r/learnprogramming 's Posting Guidelines (section Formatting Code): please edit your post to use one of the approved ways of formatting code . (Do NOT repost your question! Just edit it.) If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images. Please, do not contact the moderators about this message. Your post is still visible to everyone. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2 of 3
1
Edit: this is bad advice, please see the reply comment on why your python command is "not" working A simple way would be to add an alias to your shell. For powershell you can use Set-Alias and save it into your Profile.ps1, unsure about command prompt. Edit: for command prompt - https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt Word of advise, doing this in cmd is way more complicated than it should be. For powershell - https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-alias?view=powershell-7 Make sure to select your powershell version on the top left of the page to get the correct information, and check the notes section at the end on how to make the alias permanent.
🌐
Python
bugs.python.org › issue39051
Issue 39051: Python not working on Windows 10 - Python tracker
December 15, 2019 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/83232
Find elsewhere
Top answer
1 of 10
67

I had the same problem, due to a stupid decision from Microsoft.

I had another line in my system path variable: C:\Users\MyUserName\AppData\Local\Microsoft\WindowsApps

And Windows 10 put a python.exe file there that only redirected me to the Python page of the Microsoft Store:

Since this line was above my true Python path, typing python in the cmd prompt opened the Microsoft Store...

Solution:

Type App execution aliases in the Windows 10 search bar, and then uncheck the aliases for python.exe and python3.exe. More information is here.

2 of 10
39

The path to the Python executable needs to be in the System PATH variable. Note this is not the User PATH variable.

The OP had Python 3.6.3 installed in C:\Python\Python36-32, however a common default location for installation is in the users AppData\Local\Programs\ folder. This post will assume a Python 3.10 installation in this location. Please adjust as needed for your current Python version and path.

You can confirm the path from the command prompt by checking the Python executable directly from the folder.

cd %LOCALAPPDATA%\Programs\Python\Python310
python --version

This should print the Python interpreter version. For example, Python 3.10.4.

Add the following entries to the System PATH:

  • %LOCALAPPDATA%\Programs\Python\Python310 for the python executable
  • %LOCALAPPDATA%\Programs\Python\Python310\Scripts for tools such as pip

After adding the path to the System PATH variable, make sure you close and reopen any command prompts, so they use the updated PATH.

Top answer
1 of 1
1

Whenever I run python in cmd I get this error 'python' is not recognized as an internal or external command, operable program or batch file.

You need to add python.exe to your Windows path variable(s). You can do this when installing Python with the official installer from python.org by selecting a custom installation and marking the correct option to add Python to your environment variables.

If you need to add the path to Python to your Windows path variable(s) manually (ex. because Python is already installed), look for the Windows Search and type env into it. Click the first link indicating you wish to edit your environment variables.

  • If you are on Windows 7, add e.g. ;C:\path\to\python to the end of your Path variable under System variables, where python is your Python installation folder (only use PATH under your user variables if you want Python to be accessible by that user alone). If you click the wrong link in Windows Search, you may need to click the Environment Variables... button to get to the settings described.

  • On Windows 10, just add C:\path\to\python to the end of the list (in a new field).

  • Do not add python.exe to your path entry (i.e. C:\path\to\python\python.exe is wrong).

Python will work in my Jupyter Notebook, but if I need to pip install something I am unable to do so.

Adding Python to you environment variables through the official installer (above) should solve this. If not, you will need to perform the same (rough) steps above but add C:\path\to\python\Scripts to your path (Scripts is the folder where pip.exe lives).

In either case, reboot your PC before attempting to access python/pip from the command line.

🌐
Medium
medium.com › @viknesh2798 › how-to-fix-the-issues-while-using-python-command-in-the-command-prompt-ba56d9018c5f
[SOLVED] Windows: Python command not found in CMD and Microsoft store pops up when I type python in CMD..! | by Viknesh M R | Medium
April 30, 2022 - Secondly, even after the adding the python path to the environment variable, We couldn’t run the python in the command prompt and it was redirected to the Microsoft store to install python. ... This is because, the windows system will check the command in the path and prioritize the path from top to bottom.
🌐
C# Corner
c-sharpcorner.com › article › python-py-works-but-python-doesnt
Python -- "py" works, but "python" doesn't
June 2, 2023 - Because the issue is due to the environment PATH not setup well, we can simply use the doskey command to make the Python environment PATH the same as py; we show this by phthon2 as a command: We can see both python2 and py runs the Python app. We can setup the environment PATH variable through the System Properties => Advanced Tab ... This will open the System Properties Window directly.
🌐
Codidact
software.codidact.com › posts › 291797
Why can't I run freshly-installed Python from the command line on Windows? - Software Development
You can also add the appropriate path to PATH explicitly from the command line or from the Windows GUI. Make sure you understand how to make these changes permanent. Finally, you can always just use a virtual environment. They fix everything, really. The fact that you may get an offer to install Python when you already have it, results from an amusing combination of events. In May 2019, a Windows 10 update added some Microsoft Store "helpers" for Python.
🌐
Python.org
discuss.python.org › python help
Python not found by command prompt - Python Help - Discussions on Python.org
February 11, 2024 - I have installed Python in Windows 11 and saved a small script called unicode.replacer.py In the command prompt, in the correct directory, when I attempt to execute: python unicode.replacer.py command prompt reports: …
🌐
Reddit
reddit.com › r/learnpython › python works, "py" doesn't
r/learnpython on Reddit: Python works, "py" doesn't
June 12, 2024 -

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.

🌐
Reddit
reddit.com › r/learnpython › can't fix 'python not recognized as a command' in cmd.
r/learnpython on Reddit: Can't Fix 'python not recognized as a command' in cmd.
January 2, 2023 -

When I type 'python -m pip install [something]',I know that i can just say pip install but in general it says 'Python nije prona' or in english ' python is not recognized as an internal or external command, operable program or batch file. '
I've tried to fix it countless times by reinstalling, deinstalling every python file i have on my pc then reinstalling it, adding python to the path in environment variables and yet nothing worked. Does anyone have a solution for this?

🌐
Python
docs.python.org › 2 › faq › windows.html
Python on Windows FAQ — Python 2.7.18 documentation
July 19, 2020 - On Windows, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter (D:\Program Files\Python\python.exe "%1" %*). This is enough to make scripts executable from the command prompt as ‘foo.py’. If you’d rather be able to execute the script by simple typing ‘foo’ with no extension you need to add .py to the PATHEXT environment variable. Usually Python starts very quickly on Windows, but occasionally there are bug reports that Python suddenly begins to take a long time to start up. This is made even more puzzling because Python will work fine on other Windows systems which appear to be configured identically.
🌐
Initial Commit
initialcommit.com › blog › python-is-not-recognized-as-an-internal-or-external-command
Python is not recognized as an internal or external command
May 6, 2021 - Windows users in particular may find themselves greeted with a strange and convoluted error message when trying to run Python from the Command Prompt: 'python' is not recognized as an internal or external command, operable program or batch file.
🌐
Quora
quora.com › Why-is-Python-not-working-in-CMD
Why is Python not working in CMD? - Quora
Answer: Have you checked your path variable? If python is not in the path variable, it will not work. To check, 1. Open Control Panel 2. Navigate to System 3. Go in advanced system settings 4. Go in environment variables 5. In System variables, search for path. 6.Double click on path to open e...