使用pytest运行测试时出现 ImportError: No module named _pluggy
错误 .
然后我尝试使用 pip install pluggy
安装插件 . 它成功安装 pluggy==0.6.0
,但仍然给出错误 .
Versions List (来自运行 pip freeze | grep pytest
)
-
pytest == 3.3.1
-
pytest-cov == 2.5.1
-
pytest-metadata == 1.5.0
-
pytest-runner == 3.0
-
pluggy == 0.6.0
-
Python 2.7.12
下面显示的是堆栈跟踪
在virtualenv中运行时,测试成功运行 . 在非虚拟环境中可能导致此错误的可能原因是什么?
1 回答
正如@bouteillebleu所指出的那样,问题出在pytest-metadata包中 .
解决方案是升级包