VS代码中的Run按钮不显示[Python]

2024-04-27 04:34:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我最近在VS代码中使用Python创建了一个应用程序。我做了一些修改,现在左上角的Run按钮不见了。我只能在调试模式下运行应用程序。我已经试着点击另一篇文章中建议的小错误。当我与Github共享我的代码时,它在我的macbook上也这样做。如果我在一个新文件中运行相同的代码,运行按钮就会返回

see the image as an exemple.

你有没有办法解决这个问题而不必创建新文件


Tags: 文件run代码github应用程序错误文章按钮
3条回答

转到扩展,然后键入python 第一个结果必须是微软开发的python 安装/启用或重新加载,按钮将显示enter image description here

Python Extension

尝试安装“CodeRunner”扩展,这样您就可以在VSCode中运行程序

这里有两个选项:

  • 为Visual Studio代码安装Microsoft Python扩展和为Visual Studio代码安装Microsoft Jupyter扩展

在Microsoft Visual Studio代码的扩展名:Marketplace中搜索Python并点击安装

enter image description here

在Microsoft Visual Studio代码的扩展名:Marketplace中搜索Jupyter并点击安装

enter image description here

也可以使用终端或命令提示符安装它们。打开终端或命令提示符,并在那里写入这些命令

安装Microsoft Python扩展

code --install-extension ms-python.python

安装Microsoft Jupyter扩展

code --install-extension ms-toolsai.jupyter
  • 安装Visual Studio代码的代码运行程序

在MicrosoftVisualStudioCode的扩展名:Marketplace中搜索CodeRunner并点击安装

enter image description here

也可以使用终端或命令提示符进行安装。打开终端并写入命令

安装代码运行程序

code --install-extension formulahendry.code-runner

您必须使用Microsoft提供的第一个选项。如果您同时使用这两个选项,安装Code RunnerMicrosoft PythonJupyter扩展,那么Microsoft Python扩展只有在禁用Code Runner时才能工作

< > > C++ > Jupyter、JavaScript、Perl、.<强>但对于<强> Python <强> >微软Python和java < /强>扩展是最好的。p>

相关问题 更多 >