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

就可以解决了。

相关推荐
belldeep7 分钟前
python:markdown + python-docx 将 Markdown 文件格式转为 Word 文档
python·word·markdown·docx
ChangYan.8 分钟前
VSCode终端设置为管理员权限,解决operation not permitted问题
ide·vscode·编辑器
小钻风336625 分钟前
软件测试: 从入门到实践(接口自动化)
软件测试·python·自动化
别多香了35 分钟前
Python 基础--循环判断&字符串
开发语言·python
老歌老听老掉牙37 分钟前
使用 Matplotlib 自定义坐标轴字体及刻度样式详解
python·matplotlib
股朋公式网1 小时前
斩仙飞刀、 通达信飞刀 源码
python·算法
不吃橘子的橘猫1 小时前
NVIDIA DLI 《Build a Deep Research Agent》学习笔记
开发语言·数据库·笔记·python·学习·算法·ai
学Linux的语莫1 小时前
python的基础使用
开发语言·python
万粉变现经纪人2 小时前
如何解决 pip install SSL 报错 ValueError: check_hostname requires server_hostname 问题
网络·python·网络协议·beautifulsoup·bug·ssl·pip
逻极2 小时前
FastAPI + SQLAlchemy 现代API项目实战:从零到上手的Python MySQL开发指南
python·mysql·fastapi·异步·sqlalchemy