9

Installed pre-commit successfully using the following command in VSCode:

python3 -m pip install pre-commit --user

but when I try to do the pre-commit install, I get the error message:

zsh: command not found: pre-commit
anthony sottile
  • 61,815
  • 15
  • 148
  • 207
Alexis Han
  • 91
  • 1
  • 1
  • 2
  • 4
    Does this answer your question? [commands not found on zsh](https://stackoverflow.com/questions/18428374/commands-not-found-on-zsh) – franklin Oct 02 '20 at 17:55
  • 4
    the `PATH` entry for `--user` installs is usually `~/.local/bin` on linux -- also modern pip usually gives you a warning if it's installing to a place not on your PATH -- can you show the output of the `pip` command? – anthony sottile Oct 03 '20 at 16:01
  • deleting the virtual env and recreating it fixed this for me – kuvic Apr 28 '22 at 13:26
  • For me the issue was that I had installed python via asdf and I had to run the reshim command after installing pythong + pre-commit via the command: `asdf reshim python` see https://gist.github.com/rubencaro/888fb8e4f0811e79fa22b5ac39610c9e – RamRovi Oct 25 '22 at 17:16

1 Answers1

7

Try adding this command to your .zshrc so that it recognizes your .bashrc commands, something similar to yours was happening to me.

[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'

for more information: How can you export your .bashrc to .zshrc?

Steve Matos
  • 71
  • 1
  • 3