title: `python -m pytest` vs pytest in virtualenv?
body: <p>In my old virtual environment, I was able to execute <code>pytest tests/unit/</code> directly. </p>
  
  <p>Then somehow I messed up my environment and had to remove and reinstall my <code>.venv</code> </p>
  
  <p>Then after I activate the new <code>.venv</code> and reinstall all packages, I tried <code>pytest tests/unit/</code> but it gives this error: </p>
  
  <pre><code>(.venv) john@MacBook-Pro:~/myproject$ pytest tests/unit/nti/ -p no:warnings 
  -bash: /usr/local/bin/pytest: /usr/local/opt/python/bin/python3.6: bad interpreter: No such file or directory
  </code></pre>
  
  <p>After some painful trials, I found that I can run tests with: </p>
  
  <p><code>(.venv) john@MacBook-Pro:~/myproject$ python -m pytest tests/unit/nti/ -p no:warnings</code></p>
  
  <p>SO, what is the difference between <code>python -m pytest</code> vs <code>pytest</code> ? Why would <code>pytest</code> fail to work but <code>python -m pytest</code> is fine? </p>