我如何从 vscode 在 cmd 中运行 python 文件 [英] How do i run python file in cmd from vscode

查看:76
本文介绍了我如何从 vscode 在 cmd 中运行 python 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打印长输出的 python 程序.当我尝试在 vscode 中运行该文件时,其交互式窗口不足以查看完整输出.那么有什么方法可以从 VSCODE 在 cmd 中运行 python 文件?

I have a python program which prints long outputs. When i try to run that file in vscode, its interactive window isn't enough to view full output. So is there any way to run python file in cmd from VSCODE?

推荐答案

如果你正在运行 Windows,VSCode 默认使用 Powershell 作为你的终端.如果要改用命令提示符,请按 ctrl+shift+p,在命令托盘中键入 Shell,选择 Terminal: Select Default Shell,并将其更改为 Command Prompt.我不确定这会解决您的问题,因为我认为 Powershell 应该显示与 CMD 一样多的输出,但是如果您想尝试切换终端,那就可以了.另一种选择是尝试在 CMD 或 Powershell 中本地运行它,而不是使用 VSCode 集成终端.如果更换终端没有帮助,那可能会更好.

If you are running windows, VSCode uses Powershell as your terminal by default. If you want to use the command prompt instead, hit ctrl+shift+p, type Shell into the command pallet, select Terminal: Select Default Shell, and change it to Command Prompt. I am not sure this will fix your problem as I think Powershell should display just as much output as the CMD, but if you want to try switching terminals, that will do it. Another option is to try to run it natively in CMD or Powershell, rather than using the VSCode integrated terminal. That might be better if changing terminals doesn't help.

这篇关于我如何从 vscode 在 cmd 中运行 python 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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