Hello, if you install Python from official installer you need to add Python executable to PATH, This article have good explanation for that [image] How to Add Python to PATH – Real Python In this tutorial, you'll learn about how to add Python, or any other program, to your PATH environm… Answer from gunungpw on discuss.python.org
🌐
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: …
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

Python --version command isn't working on windows
giving the command python --version gives the following error Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. I think when I first installed python 5 or 6 years ago, I didn’t install it ... More on discuss.python.org
🌐 discuss.python.org
6
0
December 30, 2023
Im trying to install Python, yet it keeps saying "Python was not found;". I installed it as a path, manually installed it as a path, help.
You must realize that what you've given us so far amounts to nothing. We don’t know the context,what os you're using, how you tried to install,basically, nothing actionable. Wanna try that again? More on reddit.com
🌐 r/learnpython
31
4
October 26, 2024
Cant find python through command prompt
After i install python and select the copy as path option it is not shown through command prompt when i type the command "python --version " it shows as ‘python–version’ is not recognized as an internal or external command, operable program or batch file. how to solve this error . now ... More on discuss.python.org
🌐 discuss.python.org
0
0
August 10, 2023
Python: command not found
Hi I’m very new to Python and I’m trying to get it set up with VSC, however I keep getting the following error whenever I try to run any commands: /bin/sh: python: command not found I’ve googled and tried solutions such as installing homebrew, but to no avail. More on discuss.python.org
🌐 discuss.python.org
2
0
December 28, 2022
People also ask

How should I interpret "CMD Can't Find Python"?
When the Command Prompt is unable to find the Python interpreter needed to run Python programs, the error message "CMD Can't Find Python" occurs.
🌐
codingdeeply.com
codingdeeply.com › home › cmd can’t find python: here’s how to fix it
CMD Can't Find Python: Here's How To Fix It - Codingdeeply
The error notice "CMD Can't Find Python"—how can I fix it?
Change the PATH environment variable to include the Python installation path, reinstall Python, or look in the Python installation directory to fix the "CMD Can't Find Python" problem.
🌐
codingdeeply.com
codingdeeply.com › home › cmd can’t find python: here’s how to fix it
CMD Can't Find Python: Here's How To Fix It - Codingdeeply
🌐
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 - Firstly, Most of us might have faced this error, python command is not recognized, because the system couldn’t identify the path where the python.exe file was located.
🌐
Python.org
discuss.python.org › python help
Python --version command isn't working on windows - Python Help - Discussions on Python.org
December 30, 2023 - giving the command python --version gives the following error Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to fix the "python: command not found" error
How to Fix the "python: command not found" Error
December 11, 2025 - The python: command not found error occurs when the system cannot find the Python executable file, preventing users from executing Python commands or running scripts.
Find elsewhere
🌐
CodeWithHarry
codewithharry.com › blogpost › solving-python-not-found-run-without-arguments
[Solved] python was not found; run without arguments to install from the microsoft store, or... | Blog | CodeWithHarry
"Encountered the 'Python was not found' error on your Windows system? Our step-by-step guide walks you through the process to locate and set Python paths, ensuring smooth execution. With clear instructions, images, and videos, you'll resolve this issue in no time.
🌐
Educative
educative.io › answers › err-python-is-not-recognized-as-an-internal-or-external-command
Err: Python is not recognized as an internal or external command
The PATH variable in windows tells the operating system where to find executable files, and if Python is not included in it, the system won't recognize Python commands.
🌐
Codingdeeply
codingdeeply.com › home › cmd can’t find python: here’s how to fix it
CMD Can't Find Python: Here's How To Fix It - Codingdeeply
February 23, 2024 - Change the PATH environment variable to include the Python installation path, reinstall Python, or look in the Python installation directory to fix the “CMD Can’t Find Python” problem.
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.

🌐
Python.org
discuss.python.org › python help
Cant find python through command prompt - Python Help - Discussions on Python.org
August 10, 2023 - After i install python and select the copy as path option it is not shown through command prompt when i type the command "python --version " it shows as ‘python–version’ is not recognized as an internal or external command, operable program or batch file. how to solve this error . now ...
🌐
Python.org
discuss.python.org › python help
Python: command not found - Python Help - Discussions on Python.org
December 28, 2022 - Hi I’m very new to Python and I’m trying to get it set up with VSC, however I keep getting the following error whenever I try to run any commands: /bin/sh: python: command not found I’ve googled and tried solutions suc…
🌐
Reddit
reddit.com › r/learnpython › when i enter a command in cmd it says "python was not found" but if i enter "py" it recognises python and gets me into it
r/learnpython on Reddit: When I enter a command in Cmd it says "Python was not found" but if I enter "py" it recognises python and gets me into it
October 8, 2022 -

New to this stuff. Installed Python 3.9.0 today. Added the exe file and scripts directory to Path manually. Still can't seem to get it working.

The commands I tried all starts with: "Python3 -m".

The "Python3 -m pip install" command didn't work either. But when I opened cmd inside the "Scripts" folder then tried "pip install" without the "Python3 -m " part, it worked.

So do I need to make changes to the "Python3 -m" part? The directory of the exe file is "C:\Python39"

Also if I have to run the commands inside Python (instead of running it on cmd normally) what changes do I have to make to the commands (like how I removed "Python3 -m" part from pip install)

🌐
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?

Top answer
1 of 5
65

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.

2 of 5
53

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.

🌐
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...
🌐
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 - If you're seeing a python: command not found error on a Unix-like operating system, simply use your package manager to install the latest version of Python and then try running the command again.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-was-not-found-run-without-arguments-to-install
Python was not found; run without arguments to install from the Microsoft Store | bobbyhadz
Copied!Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App execution Aliases.