After installing binary to another directory, error "No such file or directory"

After uninstalling a program with apt and reinstalling it in another location (ex. pypy with snap), running the program from command line reports bash: /usr/bin/pypy: No such file or directory, but which pypy correctly gives /snap/bin/pypy. How do I get the shell to recognize the new installation location?


Use hash -r. See What does hash -r command do?

Alternatively restart the shell with exec bash.