【问题标题】:Running Python code inside Visual Studio Code?在 Visual Studio Code 中运行 Python 代码?
【发布时间】:2018-07-26 02:04:23
【问题描述】:

所以我最近在 Visual Studio Code 中设置了 Python,并使用名为 Code Runner 的扩展来执行 Python。唯一的问题是,它不允许输入到终端,所以如果我运行包含 input 函数的代码,整个 IDE 将冻结,无法摆脱它或重新运行代码,因为它说它已经正在运行,我必须重新启动 IDE。

有人可以帮忙吗?

【问题讨论】:

    标签: python visual-studio-code


    【解决方案1】:

    您可以转到文件 > 首选项 -> 用户设置并添加以下内容:

        {
            "code-runner.runInTerminal": true
        }
    

    更多信息请参考:

    https://github.com/formulahendry/vscode-code-runner/issues/91

    另外,如果没有任何问题,您可以随时使用 python IDE。这里还有另一个带有 python 输入和 Visual Studio 的线程:Running python script in Visual Studio Code; how to get `input ()` to work?

    【讨论】:

    • 我知道这是强迫症,但原来的终端有 4 行,每次调试时也会打印出来,这让我很恼火。但是谢谢,这是我最接近的。
    猜你喜欢
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-23
    • 2021-03-05
    • 2019-08-03
    相关资源
    最近更新 更多