A knife is a very poor choice of self defense unless you are already very skilled at close quarters combat with a knife, and even then, it comes at extremely high personal risk, it should be a weapon of surprise that is an absolute last resort.
Pepper spray (if it is an option where you live) is a MUCH better first option for someone who may not be capable of fighting off an attacker, but being aware and cautious is the best way to avoid attacks.