安装了pytest但在bash中运行pytest返回未找到

时间:2018-11-05 12:56:52

标签: python django vagrant pytest pytest-django

我正在遵循Vagrant(Ubuntu 18.04 / Python3.6.6)中的python-django教程。运行pip3 install pytest-django并配置pytest.ini文件后,运行pytest返回

Command 'pytest' not found, but can be installed with:

apt install python-pytest
Please ask your administrator.

pip3 freeze输出:

pytest==3.10.0
pytest-django==3.4.3

安装还有其他内容吗?

1 个答案:

答案 0 :(得分:1)

尝试使用python -m pytest

通过pip安装pytest不会使其成为系统命令,而是会将其安装到python。 -m命令将pytest作为其自己的命令运行,然后任何继续执行的脚本都将作为参数。