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

Code-OSS无法运行Python脚本问题求助(Garuda Linux环境)

问题描述

使用Garuda Linux发行版,Code-OSS版本1.74.2-1,Python版本3.10.9-1。近几周Code-OSS无法运行Python脚本:打开原有可正常工作的.py文件或新建文件时,弹出错误提示:

Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information.

Python扩展持续处于加载状态,开启开发者工具后可见核心错误:

mainThreadExtensionService.ts:111 Activating extension 'ms-python.python' failed: Extension 'ms-python.python' CANNOT use API proposal: telemetryLogger.
Its package.json#enabledApiProposals-property declares:  but NOT telemetryLogger.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ms-python.python.

同时伴随重复的command 'python.createNewFile' not found错误。已多次尝试重装Code-OSS、Python及Python扩展,问题仍未解决。

解决方案

1. 降级Python扩展至兼容版本

当前新版ms-python.python扩展依赖的API超出了Code-OSS 1.74.2的支持范围,降级到适配版本即可:

  • 打开Code-OSS扩展面板,找到Python扩展
  • 点击扩展卡片右下角的齿轮图标,选择Install Another Version...
  • 在版本列表中选择2023.2.0或更早的版本(Code-OSS 1.74.2发布于2023年1月,对应扩展版本需匹配)
  • 安装完成后重启Code-OSS

2. 添加启动参数启用提议API

若不想降级扩展,可通过启动参数允许扩展使用未声明的提议API:

  • 终端启动:执行命令
    code-oss --enable-proposed-api ms-python.python
    
  • 桌面快捷方式修改:
    1. 找到Code-OSS的.desktop文件(通常路径为~/.local/share/applications/code-oss.desktop或/usr/share/applications/code-oss.desktop)
    2. 编辑文件,找到Exec=开头的行,修改为:
      Exec=code-oss --enable-proposed-api ms-python.python %F
      
    3. 保存后重启Code-OSS

3. 升级Code-OSS至最新版本

Garuda Linux下通过包管理器更新Code-OSS,新版本会原生支持扩展所需的API:

sudo pacman -Syu code-oss

更新完成后重装Python扩展,重启Code-OSS即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 11:45:37