关于该主题的堆栈溢出已有两篇文章;但是,他们都没有解决或解决我的具体情况.
There are already two posts on stack overflow on this topic; however, none of them have resolved or addressed my specific situation.
我已经通过pip install pytest安装了pytest.我也可以用Python导入该库.
I have installed pytest via pip install pytest. I am able to import the library in Python as well.
问题在于,当我尝试在Terminal中使用py.test命令时,我得到了py.test: command not found.
The problem is that when I try to use the py.test command in Terminal, I get py.test: command not found.
有人对我为什么不能在终端中使用该命令有任何见解吗?
Does anyone have any insight as to why I am not able to use the command in the terminal?
它甚至显示为已安装的软件包:
It even shows up as an installed package:
$ pip list cycler (0.9.0) matplotlib (1.5.1) numpy (1.10.1) pip (8.1.0) py (1.4.31) pyparsing (2.0.7) pytest (2.9.0) python-dateutil (2.4.2) pytz (2015.7) scipy (0.17.0) setuptools (7.0) six (1.10.0) tensorflow (0.5.0) vboxapi (1.0) wheel (0.26.0)推荐答案
使用python -m pytest将对您有效.
或者,如果您使用虚拟环境并在virtualenv上安装了pytest,则应在虚拟环境旁边运行py.test.
Or if you using virtual environment and installed pytest on virtualenv you should then run py.test alongside your virtual environment.
检查此网站可能有用: pythontesting/framework/pytest/pytest-introduction/
Check this website can be useful:pythontesting/framework/pytest/pytest-introduction/
更多推荐
找不到Py.test命令,但已安装库
发布评论