Python was not found but can be installed from the Microsoft store (March, 2020)

Question:

I started watching a Python course on YouTube in which the guy giving the lesson teaches using VSCode. He started with software installation (Python & Pycharm). Then, in VSCode he downloaded the Python extension (the one made by Microsoft) and the extension called "Code Runner" to run the Python code on VSCode. When I try running my code it hits me with the following error which you can also see in the image on the link at the end of the question. I’m not able to post a screenshot of it because I’m new on this platform. Thanks to whoever sees this.

[Running] python -u "c:UsersRyanDesktopPythonapp.py"
Python was not found but can be installed from the Microsoft Store: htttps://go.microsoft.com/fwlink?linkID=2082640

Screenshot of the VSCode error screen:

enter image description here

Asked By: Luis M.

||

Answers:

I think you need to install Python first before using VSCode. You can download it from here: https://www.python.org/downloads/

Once it is installed, VSCode should detect it and run without problems.

Answered By: Chadee Fouad

You don’t have the command python installed into your PATH on Windows which is the default if you didn’t get your copy of Python from the Windows Store. If you selected your Python interpreter in VS Code (look in the status bar), then I would disable Code Runner. That way the Python extension is what provides the ability to run Python (the Play button will be green instead of white).

Answered By: Brett Cannon

Sometimes this happens if you are using a virtual environment and you have not activated it on your command prompt.

Answered By: Misan

python install directory, bin, and lib-scripts must be to the top of WindowsApps directory, like the image below

enter image description here

Answered By: Erfan Eghterafi

Go to start -> then search -> Manage App Execution Aliases -> turn off

Answered By: Raj Kalathiya

Prior to do "start -> then search -> Manage App Execution Aliases -> turn off" make sure that you have added PYTHONPATH with details (C:Program FilesPython37;) in system-environment-variable. Then do the "turn-off" as mentioned above. This will work

Answered By: Aniyarath

I think you need to install python from microsoft window store. enter image description hereAnd also install python from python.org

Answered By: Bipul Kumar

Type Python3 in console window.
It will take you to Microsoft Store for installing Python.
enter image description here

Answered By: ZealousWeb

PS C:UserspreetDocumentsdjango-project> py get-pip.py

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

PS C:UserspreetDocumentsdjango-project> py -m ensurepip --upgrade

Looking in links: c:UserspreetAppDataLocalTemptmp9k7p19jq
Processing c:userspreetappdatalocaltemptmp9k7p19jqsetuptools-56.0.0-py3-none-any.whl
Processing c:userspreetappdatalocaltemptmp9k7p19jqpip-21.1.3-py3-none-any.whl
Installing collected packages: setuptools, pip
WARNING: The scripts pip3.9.exe and pip3.exe are installed in ‘C:Python39Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed pip-21.1.3 setuptools-56.0.0

Answered By: Preeti Duhan

I had the same problem (and others).

Finally it was caused due to multiple Python installations.

I had already installed once python in C:ProgramsPythonpython38-32 (in system’s PATH) and used it in command line.

So while installing of Visual Studio Code – I assume – another instance of Python was (automatically) installed to c:users<username>appdatalocalprogramspythonpython37-32.
And I had both installation locations in the PATH variable:

  • c:users<username>appdatalocalprogramspythonpython37-32 in user’s PATH
  • and C:ProgramsPythonpython38-32 in the system’s PATH variable.

So I removed the path C:ProgramsPythonpython38-32 from the system’s environment variable PATH. Restarted Visual Studio Code.

And so I could now run "pip install flask" without complaining about pip should be updated from 19.x to 21.y – what was an additional strange behavior in my case.

Afterwards I could run the code in the Visual Studio Code’s terminal by e. g. "python webapp.py".

Answered By: BitLauncher
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.