python - pytest 错误:ImportError: cannot import name 'Expression' from '_pytest.mark'
问题描述
我收到此错误:
conftest.py:95: in <module>
from framework.scheduler import PytestScheduler
framework/scheduler.py:33: in <module>
from _pytest.mark import Expression, MarkMatcher
E ImportError: cannot import name 'Expression' from '_pytest.mark' (/usr/lib/python3/dist-packages/_pytest/mark/__init__.py)
它可能是我的 pytest 版本吗?我怎么知道我应该使用哪个版本?
该文件/usr/lib/python3/dist-packages/_pytest/mark/__init__.py
存在,因此已安装。
解决方案
sudo pip install --upgrade attrs==21.2.0
sudo pip install --upgrade pytest==6.2.4
为我固定
推荐阅读
- javascript - 如何使用 Context API 在 React js 中删除列表
- c# - word.ExportAsFixedFormat 在不同的系统中给出不同的输出
- r - glm 预测和使用相同 glm 的 geom_smooth() 之间的差异
- java - 如何在 JPQL 中转换 MySQL 变量
- python - 获取:ValueError:预期 ndim=3,发现 ndim=2。收到完整形状:[100, 1000] 在 tensorflow 的 keras 模块中运行 model.fit()
- regex - 带变量的 AWK 负正则表达式
- python - 错误:ModuleNotFoundError:没有名为“pyqtgraph”的模块?
- python - Tensorflow - 无法获得损失和输入图像之间的梯度
- c++ - '......' 中的成员 '.......' 的错误请求,它是非类类型 '.....'
- ruby-on-rails - 你在 api-only rails 应用程序中设置 root :to 是什么?