1

I have python3 and pip3 installed. I also install pytest but when I enter the command pytest, it does not work. It shows me the following:

<zsh: command not found: pytest>

How do I fix this please?

flory
  • 27
  • 4

2 Answers2

2

@flory try this accepted answer - I had the same issue and first I thought I had to configure my zsh profile but this works:

python3 -m pytest

You can also check the version number

python3 -m pytest --version
headwinds
  • 1,781
  • 15
  • 26
0

You need to specify the location of the pytest executable—the program that executes pytest—to your computer in order to use the pytest command. You can do this by adding the directory path where the pytest executable is located to your computer's list of locations it should search for applications.

The PATH environment variable is the name given to this list.

You may use your computer's settings to update the PATH environment variable or you can execute a program in the terminal to add the path of the directory containing the pytest executable to it.

Your computer should then will be able to locate and launch pytest once the PATH environment variable has the path to the directory containing the pytest executable.