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

就可以解决了。

相关推荐
PyHaVolask19 分钟前
Python 爬虫进阶:直接请求 JSON 接口与开发者工具使用
爬虫·python·请求头·反爬·json接口·chrome开发者工具
larance21 分钟前
安装dify的几个问题
python
2301_7735536224 分钟前
CSS如何对用户访问过的链接进行降级颜色处理_使用-visited伪类改变颜色
jvm·数据库·python
2301_8152795232 分钟前
Golang怎么理解Go的sync.Pool底层_Golang如何理解Pool的本地缓存和GC清理机制【详解】
jvm·数据库·python
2301_7641505632 分钟前
MySQL迁移过程如何避免数据不一致_利用强一致性备份方案
jvm·数据库·python
m0_7164300735 分钟前
Redis如何处理预热失效引起的开局雪崩
jvm·数据库·python
m0_3776182337 分钟前
c++文件锁使用方法 c++如何实现多进程文件同步
jvm·数据库·python
gmaajt42 分钟前
mysql多字段搜索如何设计组合索引_mysql索引查询加速
jvm·数据库·python
2301_7775993743 分钟前
MySQL如何快速排查慢查询安全隐患_分析slow_query_log进行优化
jvm·数据库·python
m0_747854521 小时前
如何检测受保护链接(如 Twitter)的可访问性
jvm·数据库·python