简体   繁体   English

Visual Studio代码,Python运行/调试

[英]Visual Studio Code, Python Run/Debug

Whenever I try to run/debug any python script in Visual Studio Code (Ubuntu 16.04), it only executes once and then stops reacting to any debugging command (F5/Ctrl+F5/Shift+F5, etc.). 每当我尝试在Visual Studio Code(Ubuntu 16.04)中运行/调试任何python脚本时,它只会执行一次,然后停止对任何调试命令(F5 / Ctrl + F5 / Shift + F5等)作出反应。

I feel like I am missing something simple, but I haven't found anything related to that issue. 我觉得我缺少一些简单的东西,但是我还没有发现与该问题有关的任何东西。

The MWE: MWE:

import sys

def main(args):
    print('123')
    sys.exit(0)

if __name__ == '__main__':
    main(sys.argv)

'123' is only printed once and there is no indication of running debug afterwards. “ 123”仅打印一次,之后没有运行调试的迹象。

Any help would be highly appreciated. 任何帮助将不胜感激。

I've been having the same issue, and the only ways I have been able to work around this are to either restart Visual Studio Code or to run the script from the terminal. 我遇到了同样的问题,解决此问题的唯一方法是重新启动Visual Studio Code或从终端运行脚本。

For example, a script named myCounter.py would be run with 例如,一个名为myCounter.py的脚本将与

.\\myCounter.py 。\\ myCounter.py

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

相关问题 Visual Studio Code中的调试和运行模式中使用的不同python环境 - Different python environments used in debug and run mode in Visual Studio Code 如何在 Visual Studio Code 中调试 python 单元测试? - how to debug python unittests in Visual Studio Code? 使用Visual Studio Code在ROS中调试python脚本 - python scripts debug in ROS with Visual Studio Code 在Visual Studio Code中运行Node.js,将python脚本作为子进程调用并对其进行调试 - In Visual Studio Code run Node.js, call python script as child-process and debug it 在Visual Studio代码调试模式下使用Python Unittest运行单个测试 - Run single test using Python Unittest in Visual Studio Code Debug mode 在 Visual Studio Code 中运行 Python 代码失败 - Failure to run Python code in Visual Studio Code 如何在Visual Studio Code中运行调试Django应用程序? - How to run debug Django app in Visual Studio Code? 如何在 Visual Studio Code 中调试 Python 3 代码? - How can I debug Python 3 code in Visual Studio Code? 减少Visual Studio Code中python代码的调试启动时间 - Decrease the debug startup time of the python code in Visual Studio Code Visual Studio Code-如何在Docker容器中远程调试python代码 - Visual Studio Code - how to remote debug python code in a Docker Container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM