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")

就可以解决了。

相关推荐
花酒锄作田17 小时前
[python]Flask - Tracking ID的设计
python·flask·pytest
PeterClerk17 小时前
计算机视觉常用指标(Metrics)速查与解释(持续更新)
人工智能·python·深度学习·计算机视觉·benchmark·评测
哪有时间简史18 小时前
Python程序设计基础
开发语言·python
企业对冲系统官18 小时前
大宗商品风险对冲系统统计分析功能的技术实现
运维·python·算法·区块链·github·pygame
ValhallaCoder18 小时前
Day48-单调栈
数据结构·python·算法·单调栈
智算菩萨18 小时前
【Python小游戏】深度解析Pygame实现2048游戏的完整开发流程(有代码实现)
python·游戏程序·pygame
奔跑吧 android18 小时前
【vscode】【Continue】【插件使用】
ide·vscode·编辑器
嘉嘉嘉71718 小时前
【day 52】神经网络调参指南
python·深度学习·机器学习
测试秃头怪18 小时前
Python测试框架Pytest的参数化
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
深蓝电商API18 小时前
Scrapy 爬虫异常处理与重试机制优化
爬虫·python·scrapy