You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 2022社区版Python调试器无法正常工作的问题求助

Visual Studio 2022社区版Python调试器无法正常工作的问题求助

大家好,我遇到了一个Python调试的棘手问题,想向各位求助:

我的环境配置如下:

  • Visual Studio Community 2022(64位),版本17.12.4
  • Python 3.13
  • 已安装Python开发和.NET桌面开发工作负载

目前的问题是:代码用**"Start Without Debugging"(开始执行不调试)可以正常运行,但点击"Start Debugging"(开始调试)**时完全无法工作,按下调试按钮后控制台立刻弹出以下错误信息:

Traceback (most recent call last):
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 275, in _on_run
    self.process_net_command_json(self.py_db, json_contents)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 219, in process_net_command_json
    cmd = on_request(py_db, request)
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 532, in on_launch_request
    return self._handle_launch_or_attach_request(py_db, request, start_reason="launch")
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 521, in _handle_launch_or_attach_request
    self._set_debug_options(py_db, request.arguments.kwargs, start_reason=start_reason)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 493, in _set_debug_options
    self.api.stop_on_entry()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_api.py", line 988, in stop_on_entry
    info.update_stepping_info()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 204, in update_stepping_info
    _update_stepping_info(self)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 278, in _update_stepping_info
    if info._get_related_thread() is not None:
       ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 138, in _get_related_thread
    if thread._is_stopped:
       ^^^^^^^^^^^^^^^^^^
AttributeError: '_MainThread' object has no attribute '_is_stopped'

我已经尝试过以下解决方法,但都没有效果:

  • 卸载并重新安装Python、Python开发组件、.NET桌面开发组件,之后重启了设备
  • 参考过一个相同问题的解决方案,下载了调试符号并取消勾选“启用本机代码调试”,但调试器仍然无法正常工作

希望有遇到过类似问题或者了解解决方案的朋友能给我一些建议,谢谢!

备注:内容来源于stack exchange,提问作者yanji_88

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 03:20:06