已经有两篇关于该主题的堆栈溢出帖子;然而,他们都没有解决或解决我的具体情况。
我已经通过pip install pytest
安装了pytest。我也可以在 Python 中导入该库。
问题是,当我尝试在终端中使用 py.test
命令时,我收到 py.test: command not found
。
有人知道为什么我无法在终端中使用该命令吗?
编辑:它甚至显示为已安装的软件包:
$ 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。
检查这个网站是否有用:http://pythontesting.net/framework/pytest/pytest-introduction/
关于terminal - 未找到 Py.test 命令,但已安装库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35998992/