190

I was trying to download a GUI, but the terminal kept giving me this 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'm trying to install it using this command:

python -m pip install --upgrade pip setuptools virtualenv
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joseph Haywood
  • 1,903
  • 2
  • 5
  • 4
  • 4
    `pip` is for installing python packages. You need to install Python itself. Go to [www.python.org](http://www.python.org) and find a download link. – zvone Dec 17 '20 at 21:58
  • 2
    What do you mean by *"download a GUI"*? Can you elaborate? – Peter Mortensen Sep 10 '21 at 18:23
  • To set a `path`: https://www.javatpoint.com/how-to-set-python-path – DanielBell99 Jun 16 '22 at 15:21
  • 3
    Related: https://stackoverflow.com/questions/58754860/cmd-opens-windows-store-when-i-type-python – Karl Knechtel Jun 29 '22 at 17:00
  • Does *"download a GUI"* mean downloading a [Windows installer](https://en.wikipedia.org/wiki/Windows_Installer) (not necessarily MSI? – Peter Mortensen Aug 28 '22 at 19:37
  • OK, the OP has left the building, so we will never get an answer: *"Last seen more than 2 years ago"*. (It is unexpected at that reputation points level, but this very question was [a one-hit wonder](https://stackoverflow.com/users/14842976/joseph-haywood) (probably due to getting lucky with the search engines and/or a particular problem that was introduced at that time).) – Peter Mortensen May 11 '23 at 14:17
  • None of the answers say ***why*** it happened and what ***particular version/update*** caused it. [The closest](https://stackoverflow.com/questions/65348890/python-was-not-found-run-without-arguments-to-install-from-the-microsoft-store/65365333#65365333) is (my emphasis) *"I haven't gotten this error before and have been using Python a long time, and then* ***suddenly*** *it showed up."*. So something must have changed or been updated at that time. – Peter Mortensen May 11 '23 at 14:20
  • 1
    Does this answer your question? [CMD opens Windows Store when I type 'python'](https://stackoverflow.com/questions/58754860/cmd-opens-windows-store-when-i-type-python) – starball Jun 07 '23 at 02:50

25 Answers25

294
  1. Check your Python version and be sure it is installed on your machine

  2. Check the path environment variable

  3. Go to -> "start" and type "Manage App Execution Aliases". Go to it and turn off "Python"

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
janadari ekanayaka
  • 3,742
  • 2
  • 13
  • 17
  • 34
    I don't understand why the default python installer for windows doesn't automatically do the "manage app execution alias" thing. Super frustrating, thank you for this so much! If you're having issues, definitely try out #3 – Farley May 27 '21 at 04:00
  • 5
    Thank bro this worked. Ensure you close the existing command prompt after this setting is done. – Nages Jun 04 '21 at 13:19
  • 3
    @Farley Linux does that for you, well not really, but you do not have to worry about these pettty environment vars everytime – abhishah901 Jun 23 '21 at 19:36
  • 1
    This should be the accepted answer. Except note that this error appears after Python has been uninstalled from the Microsoft store. You then have to install Python from Python.org and then add that Python.org binary to the PATH as described in the accepted answer. – CodeMed Aug 12 '21 at 19:34
  • Ahh, Smartgit should really clarify this error a little more. I was searching for a "Manage App Execution Aliases" setting within the program itself... – AlexGeorg Aug 18 '21 at 16:16
  • 1
    @Nages, you saved my time by letting me close the command prompt – Yaakov Oct 18 '21 at 10:03
  • 1
    Manage app execution aliases was my issue as well. Changed that, closed and reopened command prompt and it worked. Thanks! – Developer Gee Feb 15 '22 at 18:08
  • 4
    "Manage App Execution Aliases" worked for me but I had to first *terminate all python.exe processes*. Before I did that, it just kept ignoring my settings. – kichik Mar 04 '22 at 19:11
  • For me this didn't work until I made sure that the Python path entries were ABOVE the entry for the microsoft windows apps. Then it worked fine. – Alex May 10 '22 at 14:29
  • also confirm your privileges. If you don't have admin prior to running "Manage App Execution Aliases" you may have confusing results. – JDOaktown Jun 25 '22 at 16:28
  • Go to -> "start" and type "Manage App Execution Aliases" doesn't work. Instead, go to PC Settings / Apps / and click on the link: App execution aliases – RichardU Oct 28 '22 at 13:54
  • definitely worked for me, windows 10 + miniconda on E:\Program Files – Shilpa Shinde May 01 '23 at 10:13
  • i also get this error. very frustrating. looking at the answer above, i think that part 2 of this answer may be helpful to me. but what is involved in this? like, what do i actually need to do? Apologies, i usually code in R where these things aren't an issue – Nathan Thompo Jun 11 '23 at 22:29
110

I was having the same issue and I fixed it by using the below method.

  1. Copy two paths of Python
%AppData%\Programs\Python\Python311
%AppData%\Programs\Python\Python311\Scripts

These are the paths where your Python interpreter is installed. Now add this path into your environmental variable. Put this path into System variable, not in user variable. I was using user variable, so I was facing the issue.

Screenshot for Environment Variables window

Gangula
  • 5,193
  • 4
  • 30
  • 59
Maninder
  • 1,539
  • 1
  • 10
  • 12
  • 3
    @Maninder - Thanks worked for me. BTW you can put `Python Path` in `User's variable` as well, to setup `Python` for each user. And only `Scripts` path should go to `System Variables` – Laxmikant Ratnaparkhi Jun 15 '21 at 03:34
  • 1
    This works, don't forget to restart your machine after putting in the paths My problem was when I type "Python" in my terminal it goes straight to microsoft store. Thank you! – kriscondev Sep 04 '22 at 07:38
  • 1
    it's imp to use `system variables` otherwise it won't work – Saad Abbasi Oct 17 '22 at 10:54
  • 1
    Make sure you find the actual path to Python.exe and add that folder to the path. As I am using version 3.10.8 - My path was C:\Users\[Username]\AppData\Local\Programs\Python\Python310 – code-it Oct 20 '22 at 18:50
96

I have a solution for you. Make sure you check the path mark during installation. Then you need to go to Manage App Execution Aliases.

Simply go to your search bar and search for Manage App Execution Aliases. You will find the attached screen and you need to turn off App Installers as you see on the screen. Also, see the path,,, follow Maninder's answer.

enter image description here

Then you are good to go! :)

Abel
  • 56,041
  • 24
  • 146
  • 247
Forhad
  • 1,460
  • 10
  • 12
  • 2
    Yeah, this is the solution to the problem, which is a real problem and there is no need for the snarkiness of the comments at the OP when he posted his question. – Alex. S. Oct 08 '21 at 03:29
  • 17
    I did that and now ti says this:'python' is not recognized as an internal or external command, operable program or batch file. – Yaakov Oct 18 '21 at 09:40
  • 1
    @Yaakov How did you solve it? I am stuck at this stage. – Ishwara Bhat Dec 06 '21 at 08:35
  • 2
    @IshwaraBhat I've encountered this and what worked for me is by just restarting my machine. – Mike Diente Dec 27 '21 at 17:57
  • 2
    @MikeDiente, Thanks. Later I realized that I had multiple python versions (from Anaconda and other installations). The manage extensions tab had multiple versions. Also system environment variables. Playing around with these solved my problem. – Ishwara Bhat Dec 29 '21 at 02:42
  • I cen't disable python.exe ailas. When I turn it off it kept shown as turned on – GyRo Jun 05 '22 at 10:40
  • The most upvoted answer is more technically correct, but I appreciate this one for the screenshot. If this is a python issue, the human brain isn't looking for "app installer". – Wingdom Nov 16 '22 at 02:44
50

I had the same issue. In Windows CMD, only: py --version, works.

I tried adding the path on System variables, and it didn't work. If you are using PyCharm as I do, try to run all commands from the IDE's terminal. It usually is on the side bar where the Run and the Console is. If it is not, go to: menu ViewTool WindowsTerminal. It worked just fine for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Strato P.
  • 509
  • 3
  • 2
  • Strange - Python 3.8 is installed but the version shows as 3.10. Might be associated with PyCharm. With PyCharm, I see "cannot open local terminal" Switching to command prompt works though. Nice tip here Peter Strato for what it's worth. Thanks – Jamie Oct 19 '22 at 15:38
27

You need to download Python from https://python.org. When in the installation, be sure to check the option that adds Python to PATH.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DeeDeeAich
  • 502
  • 1
  • 4
  • 9
  • 17
    This is not useful and can be misleading. E.g. I'm running PySpark in Jupyter. Clearly I have Python installed. Yet I still get the error. – Florin Andrei Jun 18 '21 at 01:19
  • 5
    @FlorinAndrei, I solved this issue by restarting the PC / Laptop after installation of python – Mohamed Raza Aug 12 '21 at 11:54
  • 4
    I am sure that I have python installed, but I get this error. so this isn't a good recommendation for all. – Niloofar Adelkhani Sep 19 '21 at 23:34
  • 1
    after installing the python restarting the PC worked for me – Ahmad Ayyaz Oct 03 '21 at 08:18
  • After installation, make sure to add the python paths to the PATH environment variable. Make sure it is added under System variable and not user variable. There is a comment above detailing that. – AfriPwincess Jun 02 '22 at 12:31
  • 1
    I absolutely have python installed. I get this error. – Mark Mayo Nov 17 '22 at 06:27
  • Since this was marked as the answer by the Author, I'll add more context here for others. If you install python via winget it'll make use of App Execution Alias. This poster has mentioned it - https://stackoverflow.com/a/68215805/3506966 What is this? Here's a good article about it: https://www.makeuseof.com/app-execution-aliases-guide/?newsletter_popup=1 How does Microsoft and Python Foundation utilize this, see this Microsoft documentation / FAQ: https://learn.microsoft.com/en-us/windows/python/faqs – EdC May 31 '23 at 20:56
18

I haven't gotten this error before and have been using Python a long time, and then suddenly it showed up. I think that it is a result of a Windows update designed to steer you to their store.

In any case: to remedy the problem, go to Settingsapp execution aliases → and turn "off" Python. (What they tell you to do, in other words). This should resolve the problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
7

I solved this problem for Visual Studio Code with just writing "python" in the console:

python

After that, Microsoft Store opens automatically with the Python app:

Enter image description here

And I just click Get.

And it all work!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    It is not entirely clear what opens what. Can you [clarify](https://stackoverflow.com/posts/72498944/edit)? (But ***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today.) – Peter Mortensen Aug 16 '22 at 23:45
6

All the previous answers are correct, but in my case, I was getting this, because I was not passing the version...

The fix is passing the version:

py.exe -3 your_program
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
grepit
  • 21,260
  • 6
  • 105
  • 81
5

If you have installed Python successfully with add python path, ticked on, and have added

C:\Users\<user>\AppData\Local\Programs\Python\Python39
C:\Users\<user>\AppData\Local\Programs\Python\Python39\Scripts

to the path into System variables and have turned off the "aliases" and they all didn't work, you can simply use python instead of python3 in your cmd command.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Farhang Amaji
  • 742
  • 11
  • 24
  • 4
    Also using `py` instead of `python3` works too. – HGamble Aug 24 '21 at 20:55
  • Doesn't the path (`C:\Users\\AppData\Local\Programs\Python\Python39`) depend on the particular version of Windows and how it is configured? Isn't it expressed in (another) environment variable? – Peter Mortensen Sep 10 '21 at 18:42
  • yes but it seems he has the same configuration and for the sake of helping him I ignored the general python path, and one the facts is that I just know 2 ways of these configurations because the conda and other package managers also modify the python paths differently. – Farhang Amaji Sep 11 '21 at 11:14
  • To set a `path`: https://www.javatpoint.com/how-to-set-python-path – DanielBell99 Jun 16 '22 at 15:22
5

There could be an alias of Python, such as: "py", or "python3". For me, it was solved just by typing "py".

Iyad
  • 61
  • 1
  • 6
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34109436) – conbask Mar 30 '23 at 18:14
  • On what system? [Linux](https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_20.04_LTS_(Focal_Fossa))? – Peter Mortensen May 11 '23 at 14:29
  • @PeterMortensen on Windows. Sorry for not having mentioned this:) – Iyad May 12 '23 at 16:24
4

Check the Aliases for App Execution in Windows. Search for Alias App in your Windows toolbar to find the UI for this. Try turning off anything Python related.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
3

I faced the same error while using Anaconda and trying to link the Python executable path in the command prompt.

It got rectified by going to SettingsApp execution aliases → and turning "off" Python. Then again I had to set the path for Python in Anaconda and was successful in executing "python --version" command.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ruby
  • 161
  • 1
  • 2
3

Try adding the following to your "Path" environment variable:

C:\Users\Default\AppData\Local\Programs\Python\Python37
C:\Users\Default\AppData\Local\Programs\Python\Python37\Scripts

Replace Python37 with your own version.

Editing Path in the Environment Variables

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ranch Camal
  • 501
  • 1
  • 4
  • 12
2

If you're on Windows, you may want to use the Python installer, in Windows Marketplace.

Sean
  • 31
  • 1
  • 4
    Only do that if you intend to get a quick fix. In fact you shouldn't install from the market place in most cases for development. You should look into installing through pyenv and adding those version to your PATH. instead. – thoroc May 26 '21 at 14:49
  • Of all the answers above, I have python 3 installed on my system, plus i have it on my system variables, turning it off in settings only makes CMD not recognize it. But your comment about installing from the store actually works for me. Thank you!!!!! – Sebastian Jul 24 '21 at 23:17
2

The same thing happened to me even after trying all the above-mentioned steps. I just restart my system and it was working fine. Do it and if still doesn't fix the issue then make sure you have checked "add python ( any version ) to PATH" before installing Python.

Check the option that has to be selected before installing

Amit kumar
  • 51
  • 3
2

To check in Windows

py --version

Or restart your PC first, and then use this command again.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

To sincerely resolve this issue, do the following:

  1. Uninstall the Python instance and reinstall it. Note: Make sure you check "Add variable PATH".

  2. On the command line, type:

     python -m pip install --upgrade pip setuptools virtualenv
    
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Okwo moses
  • 85
  • 6
1

None of the answers here worked for me. I did this and the error went away.

For Windows 11 which I was using, I reran the python-3.10.5-amd64.exe file from my downloads directory and then chose to modify the installation.

Then I followed these easy steps.

  1. Make sure the PIP component is checked before proceeding to install.

  2. Then check 'Add Python to environment variables' if it's not checked already.

  3. Proceed to Install.

    At this point, your error will be solved

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
NMukama
  • 1,114
  • 9
  • 10
1

I was also facing this issue after installing Python, while running the command python --version in the command prompt. Thee error was:

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

So, I too added the path in environment variables as shown, and it worked:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Brijesh Ray
  • 779
  • 8
  • 15
0

That happened to me. So, to fix it, you have to follow the following steps:

  1. Uninstall the Python version you already installed.
  2. Go ahead and open the installation file to reinstall it again.
  3. Before hitting Install Now, make sure to tick the box in front of Add Python to path.
  4. Go ahead and complete the installation procedure as usual. Steps for installing Python
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

If none of the previous answers are working, you can check if you have the Python executable in your program files.

Go to C:\Program Files and check if you have the Python application. If not, go to the python download website here and download the .exe file.

While installing you must select "Custom install" and select the location as C:/Program Files.

Install it and it should work now from anywhere. This worked for me!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • Doesn't the path (`C:\Program Files`) depend on the particular version of Windows and how it is configured? Isn't it expressed in (another) environment variable? – Peter Mortensen Sep 10 '21 at 18:41
0

I got this issue when I used Visual Studio Code as the IDE, and Anaconda as my Python compiler. And you don't need to close the "app alias" in settings, but copy your python.exe to python3.exe in your Anaconda folder.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ray
  • 73
  • 4
0

The problem is more subtle than it seems.

For example, if you are using Visual Studio Code on the bottom left, you should see Python X.X.X xx-bit (the X is the version).

If you click in there you will see where the IDE is getting the python.exe from.

Locate that folder into your file explorer and then just follow the answer that is saying to change the environments variables.

So copy the path where python.exe is and add it to the Path variable and do the same where the Script folder is (it is in the same directory where the python.exe is).

Then of course make sure your IDE is using the right Python.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

If you already have the Python executable on your machine and you are getting this error in Windows 10, search for the Python executable and copy its path then copy the path in system variables. It worked for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I see some resolutions people provided here are a bit complicated.

Here is the simpler way to install pip on Windows or whatever OS. Here is an example for Windows.

  1. go to https://bootstrap.pypa.io/get-pip.py, right-click (or Ctrl + S), and choose the Save as option, and save it in the location you want to execute to file.

  2. assume you saved it in the c/Users/Documents/get-pip.py file, and then just redirect to that file path.

  3. in the c/Users/Documents/, run python get-pip.py

  4. verify the installed pip using pip --version

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
frankiie
  • 456
  • 1
  • 6
  • 19