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

VScode中Pylance与Jedi错误标记异常问题求助

VS Code Python 错误标记异常解决方案

操作步骤

  • 第一步:切换回Pylance语言服务器
    打开VS Code设置页的settings.json配置文件,删除之前设置的"python.languageServer": "none"、"python.languageServer": "Jedi"相关配置,替换为:
    "python.languageServer": "Pylance"
    
  • 第二步:开启基础语法与错误检测规则
    在settings.json中补充以下配置,确保Pylance错误检测功能正常启用:
    {
      "python.analysis.typeCheckingMode": "basic",
      "python.analysis.diagnosticMode": "workspace",
      "python.linting.enabled": true,
      "python.analysis.errorOnMissingImports": true
    }
    
  • 第三步:重启Python语言服务
    按下快捷键Ctrl+Shift+P(Mac系统为Cmd+Shift+P)调出命令面板,搜索并执行Python: Restart Language Server,等待Pylance完成全项目加载。
  • 第四步:验证修复效果
    编写测试代码print "test",正常情况下print关键字位置会出现红色错误下划线,错误提示为「Missing parentheses in call to 'print'. Did you mean print(...)?」,同时提供自动添加括号的快速修复选项。
  • 异常兼容方案
    如果执行上述操作后问题仍存在,可打开扩展面板,卸载「Python」「Pylance」扩展后重新安装最新正式版,重启VS Code即可恢复。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.27 01:06:03