问题
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 wich 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:
回答1:
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).
回答2:
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
回答3:
python install directory, bin, and lib-scripts must be to the top of WindowsApps directory, like the image below
回答4:
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.
回答5:
Sometimes this happens if you are using a virtual environment and you have not activated it on your command prompt.
回答6:
Go to start -> then search -> Manage App Execution Aliases -> turn off
回答7:
I think you need to install python from microsoft window store. And also install python from python.org
回答8:
Type Python3 in console window. It will take you to Microsoft Store for installing Python.
来源:https://stackoverflow.com/questions/60842487/python-was-not-found-but-can-be-installed-from-the-microsoft-store-march-2020