当前位置: 首页 > news >正文

[TypeError]: type ‘AbstractProvider‘ is not subscriptable

升级pdm到2.20.0后,执行pdm add --dev mypy时报错了:

INFO: Adding group dev to lockfile
Adding packages to dev dev-dependencies: pytest, pdm, ruff, click, mypy
⠋ 0:00:00 Resolving dependencies
See /Users/mac10.12/Library/Logs/pdm/pdm-lock-aew5ui_n.log for detailed debug log.
[TypeError]: type 'AbstractProvider' is not subscriptable
WARNING: Add '-v' to see the detailed traceback

根据错误提示,打开/Users/mac10.12/Library/Logs/pdm/pdm-lock-aew5ui_n.log文件,发现报错的是:

pdm.termui: Error occurs
Traceback (most recent call last):File "/Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/termui.py", line 260, in loggingyield loggerFile "/Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 122, in do_lockresolver = resolver_class(^^^^^^^^^^^^^^^File "<string>", line 13, in __init__File "/Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/resolver/resolvelib.py", line 30, in __post_init__provider = self.project.get_provider(^^^^^^^^^^^^^^^^^^^^^^^^^^File "/Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/project/core.py", line 552, in get_providerfrom pdm.resolver.providers import get_providerFile "/Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/resolver/providers.py", line 49, in <module>class BaseProvider(AbstractProvider[Requirement, Candidate, str]):~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type 'AbstractProvider' is not subscriptable

vi /Users/mac10.12/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/resolver/providers.py打开该文件,发现报错的是resolvelib库的AbstractProvider,猜测是该库没有升级到最新版导致的。

于是执行如下命令,升级该库,问题就解决了:

cd ~/.local/pipx/venvs/pdm # 注:我的pdm是用pipx安装的
source bin/activate
python -m pip install -U resolvelib
# Uninstalling resolvelib-1.0.1
# Successfully installed resolvelib-1.1.0
deactivate
cd -
pdm add --dev ruff


http://www.mrgr.cn/news/62794.html

相关文章:

  • [网络基础]--VLAN虚拟局域网的理论讲解和配置(三种链路类型)
  • RabbitMQ怎么保障消息的可靠性
  • 夯实根基之MySql从入门到精通(一)
  • Python实现深度学习模型预测控制(tensorflow)DL-MPC(Deep Learning Model Predictive Control
  • (C#面向初学者的 .NET 的生成 AI) 第 2 部分-什么是 AI 和 ML?
  • Chromium127编译指南 Linux篇 - 额外环境配置(五)
  • 深入理解Java中的static关键字
  • Ubuntu环境本地部署DbGate数据库管理工具并实现无公网IP远程访问
  • [GXYCTF2019]Ping Ping Ping 1
  • SQL中`ORDER BY`、`SORT BY`、`DISTRIBUTE BY`、`GROUP BY`、`CLUSTER BY`的区别详解
  • Spring JdbcTemplate详解
  • C/C++ 矩阵的QR分解
  • WPF中如何解决引入MvvmLight所导致的错误
  • MPU6050六轴传感器-角度滤波(DMP+互补滤波+卡尔曼滤波)
  • Mac上搜索文件最快最高效的方法
  • ruoyi-ui启动运行时,报错Error: error:0308010C:digital envelope routines::unsupported。
  • qt QCheckBox详解
  • qt QIcon详解
  • 206面试题(1~27)
  • 运用通义灵码有效管理遗留代码:提升代码质量与可维护性
  • 深入理解 Prometheus Metrics 存储类型及应用
  • Python 的函数嵌套调用
  • 建筑八大员标准员题库
  • YOLO V2 网络构架解析
  • 搜维尔科技:数据手套|动作捕捉|模拟仿真|VR交互解决方案
  • 继承(2)