简体   繁体   中英

VS Code 'Run Python in Terminal' Play Button Not Working

Now I know that this question has been asked before at: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings but I have tried doing everything that all the answers said to do but nothing works.

I am using Visual Studio Code to run a Python file, however when I try running the file using the 'Run Python File' play button in the top right corner, it gives me this error: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I have made sure that python is installed, but just to be sure I uninstalled and reinstalled it again. I also made sure to check the box saying 'Add Python to PATH' before reinstallation. Furthermore I have also tried doing as the message prompts you to, and turned off the shortcut from Settings > Manage App Execution Aliases; but when I do that it gives me the following error:

&: The term 'C:/Users/haide/AppData/Local/Microsoft/WindowsApps/python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:3

  • & C:/Users/haide/AppData/Local/Microsoft/WindowsApps/python.exe "g:/M...
  •  + CategoryInfo: ObjectNotFound: (C:/Users/haide/...Apps/python.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException

I have also manually checked the PATH in System Properties > Environment Variables and it's fine there as well. I have also made sure that I am in powershell in the terminal rather than cmd. The file does run if I type py filename.py in the terminal, but why is the play button not working, even though it was working until yesterday?

You may check in vscode:

  1. ctrl + maj + p
  2. on the prompt, type python then select an interpreter
  3. select the path you want

That's all, this pop up is for making the green play button work fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM