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

Python 3.11在PyCharm中调试异常:大量警告无法解决

Python 3.11 + PyCharm调试时PyDev警告的解决方法

问题现象

代码可正常运行,但调试时弹出大量PyDev警告:

-------------------------------------------------------------------------------
pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)
pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints.
pydev debugger: Related bug: http://bugs.python.org/issue1666807
-------------------------------------------------------------------------------
Connected to pydev debugger (build 221.5080.212)
pydev debugger: Unable to find real location for: <frozen codecs>
pydev debugger: Unable to find real location for: <frozen importlib._bootstrap>
pydev debugger: Unable to find real location for: <frozen importlib._bootstrap_external>
pydev debugger: Unable to find real location for: <frozen zipimport>
pydev debugger: Unable to find real location for: <frozen ntpath>
pydev debugger: Unable to find real location for: <frozen genericpath>
pydev debugger: Unable to find real location for: <frozen os>
pydev debugger: Unable to find real location for: <frozen _collections_abc>
pydev debugger: Unable to find real location for: <string>
pydev debugger: Unable to find real location for: <frozen abc>
pydev debugger: Unable to find real location for: <__array_function__ internals>
pydev debugger: Unable to find real location for: <frozen io>

注:Python安装在C:\Program Files(全局路径)。

解决方法

方法一:重装Python到无空格路径(推荐)

  • 卸载当前Python 3.11,重新安装到无空格的路径,比如C:\Python311
  • 安装时勾选「Add Python to PATH」,选择「仅为当前用户安装」(避免权限及路径解析问题)
  • 删除项目旧的venv文件夹,在PyCharm中重新创建虚拟环境,选择新安装的Python 3.11作为基础解释器

方法二:禁用PyDev文件路径校验(无需重装)

  • 打开PyCharm的「Run/Debug Configurations」(右上角运行按钮下拉框→Edit Configurations)
  • 选中你的调试配置,切换到「Configuration」标签页
  • 点击「Environment variables」,添加变量PYDEVD_DISABLE_FILE_VALIDATION=1
  • 保存配置后重启PyCharm,重新调试

验证

调试项目,查看警告是否消失,调试功能是否正常使用。

内容的提问来源于stack exchange,提问作者maxxel_

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 22:40:24