vscode中的Python
我刚刚在我的Windows10计算机上下载了vs代码,我想在其中学习python。 因此,我安装了一些扩展,如“Python”、“Python” 对于VSCode,“代码运行程序”。 但是当我点击run按钮时(Ctrl+ALT+N) 我在终端中遇到以下错误:vscode中的Python,python,visual-studio-code,Python,Visual Studio Code,我刚刚在我的Windows10计算机上下载了vs代码,我想在其中学习python。 因此,我安装了一些扩展,如“Python”、“Python” 对于VSCode,“代码运行程序”。 但是当我点击run按钮时(Ctrl+ALT+N) 我在终端中遇到以下错误: python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
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 "e:\C File\Source file\practice.py"
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但是当我键入py-u“e:\C File\Source File\practice.py”
而不是python-u“e:\C File\Source File\practice.py”
它正在工作
现在我该怎么做才能在一次鼠标点击下运行它,我不想通过键入命令来运行代码。IMHO,很可能您的“Python”全局环境变量设置不正确 但是,既然您提到了
py-u[File Path]
命令似乎为您提供了输出,我可以建议您更改“code Runner”扩展发送Run命令的方式
步骤:
settings.json
文件,并尝试使用相同的快捷键Ctrl+Alt+N再次运行代码
Pranav,这能解决您的问题吗?如果不能,也许可以再次发布错误消息的剪辑
看起来像是“Python for VSCode”“扩展未正确安装。一种解决方法可能是将vscode配置为使用
py
命令而不是python
来运行python脚本。将python添加到路径在命令行上使用的此命令是什么,它不是默认的exe名称。给出分机的全名
"code-runner.executorMap": {
"python": "py -u",
},