When I tried to run Python, it was skipped to the Microsoft Store

Target audience

--People who started running Python in PowerShell and were skipped to the Microsoft Store --People who run Python scripts in PowerShell and nothing happens --People who have already set the path and could originally execute Python

environment

Conclusion

~~ The cause is unknown, but it seems that the following path is referenced. Let's change the order of environment variables. It seems that the cause is Windows 10 May 2019 Update (Thanks to @Miyukiumoo) https://forest.watch.impress.co.jp/docs/serial/yajiuma/1188376.html

The root of all evil


C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe

Background

Python cannot be executed

When I tried to run a Python script in PowerShell as usual, nothing happened and the process returned. Not even at the command prompt. When I started the interpreter as a trial, it was skipped to the Microsoft Store.

** Why? ?? ** **

By the way, at this time, I was able to execute the script normally in the virtual environment of Anaconda.

When I tried to update conda the day before, it took a lot of time and it was displayed as a messed up conflict. I used Ctrl-c to interrupt / restart, and I wonder if the default environment was broken. Anaconda I tried to put it back in, but it didn't work.

Checking executable files and environment variables

It should have been confirmed before reinserting Anaconda. .. ..

Check environment variables. The path goes to python.exe properly.

** Then why? ?? ** **

Check the path referenced by the command

I finally noticed here. I wonder why it jumped to the Microsoft Store instead of an error in the first place. If you check the path referenced by the command

> where python
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Users\user\Anaconda3\python.exe

** Something **

When I checked it with Explorer, it looked like a relatively recent file. I tried to delete it with anger, but it was also played.

I wondered if it could be erased if I executed it with administrator privileges, but I chose a way to solve it comfortably.

Change the order of environment variables

When you run the command, it scans the path of environment variables and executes the first file found. Make sure that Anaconda3's python.exe is found before the python.exe that is sent to the Microsoft Store.

You can now run Python safely.

Summary

If you cannot execute a command, first check the path referenced by the command.

It was a situation that made me want to say that my computer broke even though I hadn't done anything. Didn't you do this for later study? If so, please let me know.

Recommended Posts

When I tried to run Python, it was skipped to the Microsoft Store
I tried to make the phone ring when it was posted at the IoT post
I want to run the Python GUI when starting Raspberry Pi
[Python] I tried to analyze the pitcher who achieved no hit no run
When I tried to change the root password with ansible, I couldn't access it.
When I tried to create a virtual environment with Python, it didn't work
When I tried to introduce python3 to atom, I got stuck
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
[Python] I tried to graph the top 10 eyeshadow rankings
I tried to solve the problem with Python Vol.1
I was able to repeat it in Python: lambda
What I was addicted to when using Python tornado
I tried to summarize the string operations of Python
In IPython, when I tried to see the value, it was a generator, so I came up with it when I was frustrated.
A story that was convenient when I tried using the python ip address module
What to do if the Microsoft Store opens even if you run python on Windows
When I tried to do socket communication with Raspberry Pi, the protocol was different
What I did when I was angry to put it in with the enable-shared option
I tried to find the entropy of the image with python
I tried to simulate how the infection spreads with Python
What I was addicted to when migrating Processing users to Python
[Python] I tried to visualize the follow relationship of Twitter
I tried to implement the mail sending function in Python
I tried to enumerate the differences between java and python
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I tried to divide the file into folders with Python
I tried to touch Python (installation)
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
When I tried the AtCoder Beginner Contest, it was a terrible result, so I look back
When I tried to install Ubuntu 18.04, "Initramfs unpacking failed: Decoding failed" was displayed and the startup failed.
I tried to create a Python script to get the value of a cell in Microsoft Excel
I tried to move the ball
I tried to estimate the interval.
I tried to solve the ant book beginner's edition with python
The record I was addicted to when putting MeCab on Heroku
A memorandum when I tried to get it automatically with selenium
What I was addicted to when introducing ALE to Vim for Python
I tried to display the video playback time (OpenCV: Python version)
I tried to improve the efficiency of daily work with Python
When I tried to scrape using requests in python, I was addicted to SSLError, so a workaround memo
I tried to make it possible to automatically send an email just by double-clicking the [Python] icon
When I tried to use pip with python, I was told that XML_SetHashSalt could not be found.
A story that didn't work when I tried to log in with the Python requests module
I tried to summarize Python exception handling
I tried to implement PLSA in Python
Wrangle x Python book I tried it [2]
I tried to recognize the wake word
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to summarize the graphical modeling.
I tried to implement ADALINE in Python
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement PPO in Python
Python: I tried the traveling salesman problem
Wrangle x Python book I tried it [1]
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
What I was addicted to Python autorun
I tried the Python Tornado Testing Framework