如何在Visual Studio中调试python [英] how to debug python in visual studio

查看:96
本文介绍了如何在Visual Studio中调试python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在Visual Studio中使用python工作,请问两个问题:

I recently started working in python with visual studio and I have 2 questions please:

  1. 是否必须执行某种特殊配置才能调试python代码?我应该安装什么东西还是VS以这种方式出现?

  1. Is there some kind of special configuration that you have to perform in order to be able to debug python code? Was I supposed to install something or did VS come this way?

假设im在某个类范围内声明的函数内的解码会话中.我可以查看在 init 中定义的类变量的值吗?如果是这样,怎么办?我试图在监视窗口中写"self.someField",但没有用.

Suppose im in a decoding session, inside a function that's declared in the scope of some class. Can I view the values of the class variables defined in the init? If so, how? I tried to write "self.someField" in the watch window but it didn't work.

谢谢!

推荐答案

您可以像VS中的常规调试步骤一样调试python代码,当然,它也具有不同的设置或环境选项.如果您想获得更多详细信息,请在此处查看此文档:

You could debug your python code like general debugging steps in VS, of course, it also has different settings or Environment options. If you want to get much more detailed information, please see this document here:

调试Python代码

另外,一个线程用于一个问题,第二线程:

In addition, one thread for one issue, for the second issue:

2.假设im在某个类范围内声明的函数内的解码会话中.我可以查看课程的值吗在init中定义变量?如果是这样,怎么办?我试图写监视窗口中的"self.someField",但无效.

2.Suppose im in a decoding session, inside a function that's declared in the scope of some class. Can I view the values of the class variables defined in the init? If so, how? I tried to write "self.someField" in the watch window but it didn't work.

如果可能的话,我建议您为此新问题开一个新案例,也可以共享您的主要代码,这样其他社区成员就可以在自己的身边重现此问题.

If possible, I suggest you open a new case for this new issue, you could also share your main code, so other community members could really repro this issue in their side.

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

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