Installed pytest but running `pytest` in bash returns `not found`
Asked Answered
A

2

12

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?

Assentation answered 5/11, 2018 at 12:56 Comment(3)
Try python -m pytestFungous
yup that worked. make it an answer.Assentation
Possible duplicate of Py.test command not found, but library is installedNiobic
F
21

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.

Fungous answered 5/11, 2018 at 13:19 Comment(0)
C
0

I got problem when I wanted to run the following code in .sh file.

pytest-3 -s test.py

To solve it I get solution from linux itself as follows:

sudo apt install python3-pytest
Chlorite answered 4/4, 2022 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.