Installed pytest but running `pytest` in bash returns `not found`

Issue

I am following the python-django tutorial in Vagrant (Ubuntu 18.04 / Python3.6.6). After running pip3 install pytest-django and configuring pytest.ini file, running pytest returns

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

apt install python-pytest
Please ask your administrator.

pip3 freeze output:

pytest==3.10.0
pytest-django==3.4.3

Is there something else to the installation?

Solution

Try python -m pytest

Installing pytest via pip doesn’t make it a system command, it installs it to python. The -m command runs pytest as its own command and then any proceeding script will be an argument.

Answered By – Cory Nezin

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published