找不到Py.test命令,但已安装库 [英] Py.test command not found, but library is installed

查看:825
本文介绍了找不到Py.test命令,但已安装库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于该主题的堆栈溢出已有两篇文章;但是,他们都没有解决或解决我的具体情况.

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.

检查此网站可能有用: http://pythontesting.net/framework/pytest/pytest-introduction/

Check this website can be useful:http://pythontesting.net/framework/pytest/pytest-introduction/

这篇关于找不到Py.test命令,但已安装库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆