Python nose.plugins.cover:错误:覆盖率不可用:无法导入覆盖率模块

Python nose.plugins.cover:错误:覆盖率不可用:无法导入覆盖率模块,python,nose,coverage.py,Python,Nose,Coverage.py,在尝试计算python项目的覆盖率时,我遇到以下错误: nose.plugins.xcover: ERROR: Coverage not available: unable to import coverage module 这是我正在运行的命令: nosetests --verbosity=3 --with-xcoverage --cover-package=mypackage--nocapture --nologcapture --with-xunit --cover-inclusive

在尝试计算python项目的覆盖率时,我遇到以下错误:

nose.plugins.xcover: ERROR: Coverage not available: unable to import coverage module
这是我正在运行的命令:

nosetests --verbosity=3 --with-xcoverage --cover-package=mypackage--nocapture --nologcapture --with-xunit --cover-inclusive
我不知道为什么会出错,我安装了
coverage
包,nosetests有两个插件coverage和xcoverage

这是pip冻结的输出:

certifi==2018.4.16
chardet==3.0.4
coverage==4.5.1
fasteners==0.14.1
idna==2.7
jenkins-job-builder==2.2.1
jenkinsapi==0.3.6
Jinja2==2.10
MarkupSafe==1.0
monotonic==1.5
multi-key-dict==2.0.3
nose==1.3.7
nosexcover==1.0.11
pbr==4.2.0
psutil==5.4.6
python-jenkins==1.1.0
pytz==2018.5
PyYAML==3.13
requests==2.19.1
six==1.11.0
stevedore==1.29.0
tornado==5.1
urllib3==1.23
websocket-client==0.48.0
以及
nosetests--plugins的输出:

Plugin capture
Plugin failuredetail
Plugin xunit
Plugin deprecated
Plugin skip
Plugin multiprocess
Plugin logcapture
Plugin xcoverage
Plugin coverage
Plugin attributeselector
Plugin doctest
Plugin profile
Plugin id
Plugin allmodules
Plugin collect-only
Plugin isolation
Plugin pdb

我在Windows 10上使用的是Python 3.7.0,很可能是您的
pip
命令安装到了与
nosetest
不同的Python中。尝试使用
python-mpip
python-mnose.main
以便所有内容都来自同一个安装