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

就可以解决了。

相关推荐
罗罗攀6 分钟前
PyTorch学习笔记|张量的广播和科学运算
人工智能·pytorch·笔记·python·学习
傻啦嘿哟26 分钟前
Python 操作 Excel 条件格式指南
开发语言·python·excel
2301_8073671927 分钟前
Python日志记录(Logging)最佳实践
jvm·数据库·python
2301_7957417939 分钟前
构建一个基于命令行的待办事项应用
jvm·数据库·python
小鸡吃米…1 小时前
Python 网络爬虫 —— 环境设置
开发语言·爬虫·python
sw1213891 小时前
Python字典与集合:高效数据管理的艺术
jvm·数据库·python
进击的小头1 小时前
第13篇:基于伯德图的超前_滞后校正器深度设计
python·算法
m0_738098022 小时前
使用Python操作文件和目录(os, pathlib, shutil)
jvm·数据库·python
好家伙VCC2 小时前
# 发散创新:用 Rust构建高性能游戏日系统,从零实现事件驱动架构 在现代游戏开发中,**性能与可扩展性**是核心命题。传统基于
java·python·游戏·架构·rust
小璐资源网2 小时前
Java 21 新特性实战:虚拟线程详解
java·开发语言·python