【问题标题】:Installed pytest but running `pytest` in bash returns `not found`安装了 pytest 但在 bash 中运行 `pytest` 返回 `not found`
【发布时间】:2019-04-08 20:12:57
【问题描述】:

我正在关注 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

还有其他的安装吗?

【问题讨论】:

标签: python django vagrant pytest pytest-django


【解决方案1】:

试试 python -m pytest

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

【讨论】:

    猜你喜欢
    • 2020-01-11
    • 2022-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多