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

就可以解决了。

相关推荐
萝卜白菜。5 分钟前
TongWeb8.0 JNDI缓存
开发语言·python·缓存
xiaoshuaishuai87 分钟前
PyCharm性能调优
ide·python·pycharm
&&Citrus33 分钟前
【CPN 学习笔记(三)】—— Chap3 CPN ML 编程语言 上半部分 3.1 ~ 3.3
笔记·python·学习·cpn·petri网
Dream of maid36 分钟前
Python(11) 进程与线程
开发语言·python
财经资讯数据_灵砚智能43 分钟前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年4月7日
大数据·人工智能·python·信息可视化·语言模型·自然语言处理·ai编程
Yqlqlql1 小时前
# Python : Word 文档标注工具
python
忽而今夏&_&1 小时前
python 刷题最基础的一些
开发语言·python
陶瓷好烦1 小时前
智能编码助手:VSCode+Keil+Kilo Code打造自然语言编程环境
vscode·stm32·单片机
橘子编程1 小时前
编译原理:从理论到实战全解析
java·linux·python·ubuntu
Metaphor6922 小时前
使用 Python 设置 Excel 表格的行高与列宽
开发语言·python·excel