在Visual Studio中使用PTVS调试Python代码时出现控制台窗口 [英] Console Window Appears while debugging Python code using PTVS in Visual Studio

查看:249
本文介绍了在Visual Studio中使用PTVS调试Python代码时出现控制台窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将PTVS集成到Visual Studio中,因此我可以具有智能感知支持和调试功能. 我在功能定义中设置了断点,但是当我调试时,控件直接退出了功能.在某些情况下,会弹出控制台"窗口,并且永远不会迭代到下一行代码. 我喜欢PTVS,但是这件事使我感到困惑. 在options-> Python tools-> Interpreter选项中,我将其设置为Python 2.7 任何人都可以告诉我这些选项有什么问题以及为什么出现该控制台屏幕.

I have integrated PTVS into Visual studio so that i can have intellisense support and debugging capability. I set Breakpoints at Function definitions, but when i debug the control goes directly out of function. And in some points the Console window pops up and it never iterates to the next line of code. I liked PTVS but this thing has stuck me up. In options->Python tools-> Interpreter options i have set it as Python 2.7 Can Anyone tell me whats wrong with the options and why that console screen is appearing.

谢谢.

推荐答案

当您说要在函数定义中设置断点时,是指在行上使用"def ...",还是在断点处设置断点.函数的第一条语句?

When you say you're setting breakpoint at function definitions do you mean on the line with the "def ..." or are you setting the breakpoint on the 1st statement of the function?

在Python函数中,可执行函数是可执行语句,因此,如果将断点放在def行上,则在定义函数而不是执行函数时会碰到断点.

In Python functions are executable statements so if you're putting the breakpoint on the def line then you're going to hit the breakpoint when the function is being defined rather than being executed.

就控制台窗口而言,通常会打开它,除非您在项目属性中将您的应用程序标记为Windows应用程序(这将启动不包含控制台窗口的pythonw.exe).

As far as the console window it will generally open unless you mark your app as a Windows application in project properties (this will launch pythonw.exe which doesn't include a console window).

如果这样做没有帮助,则可能要发布遇到问题的代码或设置了断点的代码的屏幕截图.

If that doesn't help you might want to post the code you're having trouble with or a screenshot of the code with where the breakpoints are set.

这篇关于在Visual Studio中使用PTVS调试Python代码时出现控制台窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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