deter (someone or something) from (something)
To cause or encourage someone not to do something. The threat of rain deterred us from going to the beach this weekend.
deter someone or something from something
to prevent or discourage someone or a group from doing something. We can't seem to deter them from leaving. They were not deterred from their foolish ways.