Python vscode debug: Error while enumerating installed packages.解决

记录一个vscode python debug时出现的错误:

具体错误如下:

E+00000.030: Error while enumerating installed packages. Traceback (most recent call last): File "/root/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/.../.../debugpy/launcher/.../.../debugpy/common/log.py", line 361, in get_environment_description report(" {0}=={1}\n", pkg.name, pkg.version) AttributeError: 'PathDistribution' object has no attribute 'name' ...

类似如下图(网图,我忘截图了):

我是在一个docker container中使用的,我的python extension版本是:v2023.22.1(也试过v2024.2.1),python版本是3.8.10。

有一些推荐做法是安装: importlib-metadatadebugpy, 在我的电脑上没有用(但是我也安装了)。

借鉴 github上的做法:
打开 报错提示中的py文件,我的是:"/root/.vscode-server/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py"把其中的:

bash 复制代码
swallow_exception("Error while enumerating installed packages.")

替换成以下:

bash 复制代码
swallow_exception("Error while enumerating installed packages.", level="info")

就可以解决了。

相关推荐
森叶12 分钟前
手搓一个 Windows 注册表清理器:从开发到 EXE 打包全流程
windows·python
骚戴30 分钟前
大语言模型(LLM)进阶:从闭源大模型 API 到开源大模型本地部署,四种接入路径全解析
java·人工智能·python·语言模型·自然语言处理·llm·开源大模型
柒壹漆32 分钟前
用Python制作一个USB Hid设备数据收发测试工具
开发语言·git·python
东哥很忙XH43 分钟前
python使用PyQt5开发桌面端串口通信
开发语言·驱动开发·python·qt
Dxy12393102161 小时前
Python的正则表达式入门:从小白到能手
服务器·python·正则表达式
艾上编程1 小时前
第三章——爬虫工具场景之Python爬虫实战:行业资讯爬取与存储,抢占信息先机
开发语言·爬虫·python
Pyeako1 小时前
网络爬虫相关操作--selenium库(超详细版)
爬虫·python·selenium
dagouaofei1 小时前
全面整理6款文档生成PPT工具,PDF转PPT不再难
python·pdf·powerpoint
β添砖java1 小时前
python第一阶段第10章
开发语言·python
有梦想的鱼1 小时前
vscode letax编译中英文论文(傻瓜式、一分钟)
ide·vscode·编辑器