VScode 当我 运行 程序时,Extension Code Runner 不是 working/error (python)

VScode Extension Code Runner not working/error (python) when I run program

当我安装代码 运行ner 扩展时,我无法 运行 python 程序弹出此错误:

[![图片][1]][1]

Copyright © Microsoft Corporation. All rights reserved. 
Try the new cross-platform PowerShell https://aka.ms/pscore6 
Warning: PowerShell detected that you might be using a screen-reader and has disabled PSReadLine for compatibility purposes. 
If you want to re-enable it, run 'Import - Module PSReadLine'. 
PS C:\Users\Admin\OneDrive\Máy tính\py projects python -u " C\Users\ Admin\OneDrive\Máy tính\py project\test.py " python : The term 'python' 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 :1 
+ python -u " C:\Users\Admin\OneDrive\Máy tính\py project\test.py "  ' ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotException
+ FullyQualifiedErrorId : CommandNotFoundException

当我关闭扩展时代码 运行 正常,但是当我打开时弹出错误。 感谢您阅读我的问题! ( •̀ ω •́ )✧ [1]: https://i.stack.imgur.com/62MI3.png

确保您已安装 python。在 VScode 的左下角,您必须选择一名口译员并确保 select python。如果您需要 select 您的语言,select python,并将您的文件命名为“FileName.py”。

什么意思是“关闭扩展使其正常工作”。根据报错,这应该是你的Python环境变量设置的问题。您是否尝试过名为“运行 Python 文件”的方式?这是扩展pylance中的一个函数。

顺便说一下,您应该已经安装了 python 扩展程序。

更新:

您可以使用此选项 运行 您的 python 文件。这是微软官方提供的文件运行ning选项