Reputation: 607
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:\Users\Ryan\Desktop\Python\app.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:
Upvotes: 42
Views: 320810
Reputation: 693
I had the same problem (and others).
Finally it was caused due to multiple Python installations.
I had already installed once python in C:\Programs\Python\python38-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>\appdata\local\programs\python\python37-32. And I had both installation locations in the PATH variable:
So I removed the path C:\Programs\Python\python38-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".
Upvotes: 3
Reputation: 97
PS C:\Users\preet\Documents\django-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:\Users\preet\Documents\django-project> py -m ensurepip --upgrade
Looking in links: c:\Users\preet\AppData\Local\Temp\tmp9k7p19jq Processing c:\users\preet\appdata\local\temp\tmp9k7p19jq\setuptools-56.0.0-py3-none-any.whl Processing c:\users\preet\appdata\local\temp\tmp9k7p19jq\pip-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:\Python39\Scripts' 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
Upvotes: 0
Reputation: 1751
Type Python3 in console window.
It will take you to Microsoft Store for installing Python.
Upvotes: 5
Reputation: 101
I think you need to install python from microsoft window store. And also install python from python.org
Upvotes: 10
Reputation: 181
Prior to do "start -> then search -> Manage App Execution Aliases -> turn off" make sure that you have added PYTHONPATH with details (C:\Program Files\Python37;) in system-environment-variable. Then do the "turn-off" as mentioned above. This will work
Upvotes: 18
Reputation: 445
Go to start -> then search -> Manage App Execution Aliases -> turn off
Upvotes: 15
Reputation: 5645
python install directory, bin, and lib-scripts must be to the top of WindowsApps directory, like the image below
Upvotes: 24
Reputation: 187
Sometimes this happens if you are using a virtual environment and you have not activated it on your command prompt.
Upvotes: 0
Reputation: 16110
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).
Upvotes: 35