Windows 8.1 Windows Store

0 views
Skip to first unread message

Niobe Hennigan

unread,
Aug 5, 2024, 7:54:27 AM8/5/24
to chrisarineth
Andwhen I type Python in CMD, it opens the Windows Store for me to download Python 3.7. This problem started today for no good reason. I didn't change or download anything about Python and already tried reinstalling Python, and the Path environment variable is correct.

Use the Windows search bar to find "Manage app execution aliases". There should be two aliases for Python. Unselect them, and this will allow the usual Python aliases "python" and "python3". See the image below.


I think we have this problem when installing Python because in a new Windows installation the aliases are in the ON position as in image below. When turned on, Windows puts an empty or fake file named python.exe and python3.exe in the directory named %USERPROFILE%\AppData\Local\Microsoft\WindowsApps. This is the alias.


When you enter "python" in cmd, it searches the directories listed in your "Path" environment variables page from top to bottom. So if you installed Python after a new Windows 10 install then get redirected to the Windows Store, it's because there are two python.exe's: The alias in the App Execution Alias page, and the real one wherever you installed Python. But cmd finds the App execution, alias python.exe, first because that directory is at the top of the Path.


The first time I ran into this problem, I manually deleted the python.exe and python3.exe files but when I restarted the files regenerated. That prompted me to search for the App Execution Aliases page and uncheck the box, which solved it for me, by not allowing the files to regenerate.


Based on this Microsoft Devblog, they stated they created this system partially for new Python users, specifically kids learning Python in school that had trouble installing it, and focus on learning to code. I think Windows probably deletes those aliases if you install Python from the Windows App Store. We are noticing that they do not get deleted if you manually install from another source.


(Also, the empty/fake python.exe is not really empty. It says 0 KB in the screenshot, but entering "start ms-windows-store:" in cmd opens the Windows App Store, so it probably just has a line with that and a way to direct it to the Python page.)


Another alternative is to delete the user path environment variable that points to the alias files, %USERPROFILE%\AppData\Local\Microsoft\WindowsApps, but the App Execution Aliases handle more apps than just python, and deleting the path from environment variables breaks all the other apps that have execution aliases in that directory; which on my PC includes notepad, xbox game bar, spotify, monitoring software for my motherboard, paint, windows subsystem for android, to name a few. Also if you think about it, the average Windows user is unfamiliar editing environment variables and on school and business owned computers requires administrative access. So deleting the path to ...\WindowsApps, from the path environment variable, is not ideal.


The main problem here is that the order in the path calls the windows from top to bottom, and that there is python.exe in %USERPROFILE%\AppData\Local\Microsoft\WindowsApps which is called first if there are no other python.exes in the PATH above that line.


Solution: I tried deleting the python*.exe files in the WindowsApp directory, but Windows wouldn't allow it, so I opened a command prompt in the "%USERPROFILE%\AppData\Local\Microsoft\WindowsApps" directory and typed:


A convergence of two things: the previous introduction of the Python Launcher for Windows in 2011 (hereafter py), and a Windows 10 update in May 2019 that was apparently intended to make installing Python easier for Windows users.


Oops. Turns out that installation path isn't great; it bypasses the "lengthy" setup wizard... which contains some options that some users find very useful. It caused other issues, too. Not to mention that it just works in slightly non-standard ways, has limitations on file system access because it's a Store app, initially couldn't itself be launched by py....


Since the introduction of py, by default, Windows Python installers do not add the new Python install to the PATH. Why? Because the entire point of py is that it uses its own logic to find a Python installation, based on some combination of command-line switches and possibly the source file's own shebang line. Now your source files can be associated with py instead of any particular python.exe, and you can get Linux-like behaviour when double-clicking a file. Meanwhile, by running py at the command line, you have easy access to whatever you need, and you don't have to think about which version of Python was installed most recently. So there's seemingly no good reason to put any of those Python installations on the PATH. It only risks confusing you when, for example, the most recently installed version isn't the most up-to-date one. Right?


In the update, Windows 10 put a "python.exe" into a Windows Apps-related folder, which is a wrapper app to open a Microsoft Store link. The idea is that it's on the PATH, but way near the end; so if you have an installed Python, it gets used, and otherwise the wrapper is invoked and helpfully prompts you to install Python - so that you can actually run that random, totally trusted .py file your friend sent you on Discord.


(But, you know, py had been introduced around 8 years prior. You'd think someone at Microsoft would have been aware of the potential issue. Maybe instead of a special shortcut link, they could have made an actual script that checks for the presence of C:\Windows\py.exe or something.)


You can check the option to add new Python versions to the PATH when you install them, and deal with the fact that python at the command line means a specific one of them. If you need to change that, you can manually tweak your PATH variable.


Independently of that, you can disable the wrappers, as shown in the top answer. You should probably do this anyway; seeing python fail at the command line is less aggravating than dealing with a random GUI window popping up and offering to install something for you, especially when you know you have it already.


If you want to keep the PATH empty, consider using virtual environments for your projects. Whenever a virtual environment is active, the PATH is temporarily modified such that python means the Python installation of that environment. It's quite convenient, really.


As a person who does Python development in Sublime Text, I know you said the Python interpreter path was correct, but when you install the Python interpreter make sure to tick the option to add Python to PATH.


Aha, there is a sneaky python.exe deep inside another program's folder, this is my unique software conflations situation, and cr5000 is in system PATH, I can't make the user PATH take precedence over the system, so I have to add an python3 alias with symbolic link.


Py is an alias useful for other tasks if you have seveal versions of python. So the app execution aliases button unchecking is not recommended. The "new" way to find out the python version installed is typing in CMD


BEAT THE HEAT THIS SUMMER BY INSTALLING SUPER HIGH PERFORMANCE WINDOWS AND DOORS! LOWER THOSE ENERGY BILLS AND EXTEND THE LIFE OF YOUR A/C SYSTEM! DON'T REPLACE YOUR OLD LOW END BUILDER'S GRADE WINDOWS WITH NEW LOW END BUILDER'S GRADE WINDOWS FROM THE BIG BOX STORES! GET THE HIGHEST QUALITY PRODUCTS FROM THE #1 ONLINE DEALER IN THE NATION! BUY QUALITY AND START SAVING TODAY! IT'S TIME TO MAKE THE CHANGE! OFFER ENDS MIDNIGHT 8/07/2024!


Window e-Store has revolutionized how people buy new construction, retrofit, and replacement windows. We made buying custom home windows and doors a breeze by placing the entire process online. Save yourself the hassle of sitting through a lengthy sales pitch from a high pressure salesperson. Using our easy online builder tool, you're only a few steps away from your custom high performance new construction, retrofit, or replacement windows!


Our vast selection of residential vinyl window styles includes: sliders, single hung windows, double hung windows, awning, casement, half round, hoppers, geometric and more. Every home vinyl window is custom made to your specifications in only a few short days. Because you will be buying direct, there is no need to worry about retail window replacement prices. In addition, you can pick up your windows at any of our 600 warehouse locations nationwide or opt to have them delivered straight to your door for a small fee. Shipping is always free to any of our 600 warehouses nationwide!


This attractive, high-quality window line is ideal for any new construction or remodel project. ECOtru is stylish, sturdy, and designed to give your home reliability and comfort while giving you the perfect view. Window E-Store will tailor ECOtru's high-performance glass package to your specific geographic location. Custom grid patterns are also available. BetterVue Lifetime Warranted fiberglass screens are included with all operable windows.


ECOxtreme Windows are the premium performer. Our most advanced windows feature 1" and 7/8" double-strength IG (insulating glass) units and super high-performance coatings designed to maximize energy efficiency, soundproofing, and security. Custom grid patterns are available. Stucco or flush flange options available. BetterVue Lifetime Warranted fiberglass screens are included with all operable windows. Custom DP ratings are available upon request at no charge.


Our most powerful line, these Hurricane impact windows, offer unprecedented protection from the elements. They provide security, classic design, superb construction, and maintenance-free operation. In addition, the 1" IG (insulating glass) unit provides a high-performance thermal barrier for years of energy savings. The EcoStorm windows are approved for all Gulf and Atlantic coast regions, including Miami-Dade and Broward County, Florida. Custom grid patterns are available. Integral masonry flange available upon request. BetterVue Lifetime Warranted fiberglass screens are included with all operable windows.

3a8082e126
Reply all
Reply to author
Forward
0 new messages