简体   繁体   English

如何在 VSCode 的终端中运行我的代码?

[英]How do I run my code in the terminal in VSCode?

For Details, There are no errors, I use code runner, and the programing language is Python.详细信息,没有错误,我使用code runner,编程语言是Python。

您可以在这里找到在 VS Code 中运行 Python 代码的不同方法,包括在终端中运行: 如何从 Visual Studio Code 中执行 Python 代码

Ctrl + Shift + P ,搜索terminal ,单击,使用命令python -m my_script.py运行代码并Enter

If you have installed the Code Runner extension, the play button in the upper right corner will have three options to run the code.如果你已经安装了Code Runner扩展,右上角的播放按钮会有三个选项来运行代码。

在此处输入图像描述

Select Run Code , and the code result will be output in the OUTPUT window. Select运行代码,代码结果将是 OUTPUT Z05B8C74CBD902FBF2DEZC13 中的output This option is to use the Code Runner extension to run code此选项是使用Code Runner扩展来运行代码

Selecting Run Java will output the result in the original terminal, and Debug Java will start code debugging.选择Run Java将 output 在原始终端中的结果,和Debug Java将开始代码调试。

If you want to use the Code Runner extension to run the code and have the result output in the TERMINAL panel.如果您想使用Code Runner扩展来运行代码并在TERMINAL面板中获得结果 output。 Please add the following configuration in settings.json :请在settings.json中添加以下配置:

    "code-runner.runInTerminal": true,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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