未找到 Py.test 命令,但已安装库 [英] Py.test command not found, but library is installed
问题描述
关于这个主题的堆栈溢出已经有两篇文章了;然而,他们都没有解决或解决我的具体情况.
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.
问题是当我尝试在终端中使用 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)
推荐答案
using python -m pytest
将为您工作.
using python -m pytest
will work for you.
或者,如果您使用虚拟环境并在 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.
检查这个网站可能有用:http://pythontesting.net/framework/pytest/pytest-介绍/
Check this website can be useful:http://pythontesting.net/framework/pytest/pytest-introduction/
这篇关于未找到 Py.test 命令,但已安装库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!