VS Code 中的运行按钮不显示 [Python] [英] The Run button in VS Code don't show up [Python]

查看:90
本文介绍了VS Code 中的运行按钮不显示 [Python]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I recently create an app using Python in VS Code. I made some modifications and now the Run button in the top left is gone. I can only run the app with the debug mode. I already try to click the little bug as it was suggested on another post. It is doing the same on my macbook when I share my code with Github. If I run the same code in a new file the Run button came back.

你有什么办法不用新建文件就可以解决这个问题吗?

Do you have any way to solve this problem without having to create a new file?

推荐答案

这里有两个选择:

  • 安装适用于 Visual Studio Code 的 Microsoft Python 扩展适用于 Visual Studio Code 的 Microsoft Jupyter 扩展

在 Microsoft Visual Studio Code 的扩展中搜索 Python:Marketplace 并点击安装.

Search for Python in Microsoft Visual Studio Code's Extension: Marketplace and hit on install.

在 Microsoft Visual Studio Code 的扩展:Marketplace 中搜索 Jupyter 并点击安装.

Search for Jupyter in Microsoft Visual Studio Code's Extension: Marketplace and hit on install.

或者您可以使用终端或命令提示符来安装它们.打开终端或命令提示符并在那里写下这些命令.

Or you can use your terminal or command prompt to install them. Open the terminal or command prompt and write these commands there.

安装 Microsoft Python 扩展,

Install Microsoft Python extension,

code --install-extension ms-python.python

安装 Microsoft Jupyter 扩展,

Install Microsoft Jupyter extension ,

code --install-extension ms-toolsai.jupyter

  • 为 Visual Studio Code 安装 Code Runner
  • 在 Microsoft Visual Studio Code 的扩展:Marketplace 中搜索 Code Runner 并点击安装.

    Search for Code Runner in Microsoft Visual Studio Code's Extension: Marketplace and hit on install.

    或者您可以使用终端或命令提示符来安装它.打开终端并写入命令.

    Or you can use your terminal or command prompt to install it. Open the terminal and write the command.

    安装代码运行器,

    code --install-extension formulahendry.code-runner
    

    您必须使用 Microsoft 的第一个选项.如果您同时使用这两个选项,则安装 Code RunnerMicrosoft PythonJupyter 扩展,然后安装 Microsoft Python仅当您禁用 Code Runner 时,扩展程序才会起作用.

    You must go with the first option by Microsoft. If you go with both the options, you install Code Runner and Microsoft Python and Jupyter extensions then the Microsoft Python extension will only work if you disable Code Runner.

    Code RunnerC、C++、Java、Javascript、Perl 等的良好扩展,但适用于 Python Microsoft Python 和 Jupyter 扩展是最好的.

    Code Runner is a good extension for C, C++, Java, Javascript, Perl, ... but for Python Microsoft Python and Jupyter extension is the best.

    这篇关于VS Code 中的运行按钮不显示 [Python]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆