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-metadata 和 debugpy, 在我的电脑上没有用(但是我也安装了)。

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

就可以解决了。

相关推荐
code tsunami14 分钟前
【无标题】
开发语言·python
CodeGL34 分钟前
10、Python基础之进程和线程
开发语言·python
TechWayfarer2 小时前
PHP漏洞被利用,怎么揪出攻击IP?
开发语言·python·tcp/ip·网络安全·php
2601_967980112 小时前
Python列表操作方法详解
python·数据类型·修改·列表操作·功能汇总
Patrick在香港3 小时前
台风在变少,来香港的没有
python·数据分析·香港·开放数据·热带气旋
qq_406981033 小时前
大白话rust系列09 函数调用两次有什么错?
开发语言·python·rust
benchmark_cc4 小时前
QuantDash 安装成功后,如何验证 Python 环境可以正常导入 SDK?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
zh路西法5 小时前
【模型式强化学习】(二)PETS——从概率动力学模型到模型预测控制(MPC)
pytorch·python·强化学习·pe·mpc·ces·pets
Python自动化直播6 小时前
智能脚本批量管理拆开看:导入、导出、重写、试听
前端·python·ai·秒播
伤心的梧桐叶8 小时前
Picset与创客贴比等待时间,没做完的任务不能从表里消失
python