If your opponent is cannon rushing you, then several things are probably also happening.
The first and most obvious one is that he has little or no unit production. At 150 minerals per cannon, building a gateway back home plus pylon is a no-go, unless your rush has already failed.
A not so evident one is that your opponent has probably been cutting probe production. When I cannon rush I do produce a few probes on the get go, always making sure that I can hit the first 100 and then 150 for the pylon / forge. Thus, they will probably have a lesser amount of income.
And finally, cannons back at home. Cannon rushing is cheese. And as all cheese, it is thought to take the opponent by surprise and unprepared. Building a pylon and at least one cannon back at home means 250 minerals less towards forward cannons. That's almost 2 less cannons to attack with. In my experience, if there is a cannon rush, there are no cannons back at home unless the rush failed and the opponent is trying to fall back to economy play (which imho, cannot happen unless you allow it).
Considering these, I would say that good PvP responses to cannon rushing would be:
1) Take whatever units you have and go for their probes. No money = no cannons. If you still have an economy going, killing off the cannons at your base is a only a matter of amassing some troops (assuming your opponent bm's and doesn't gg).
2) Expand if you have the minerals to. Abandon your base, relocate elsewhere in the map and make sure you don't get cannon rushed again t.t . You will be ahead in economy and units. Make sure that they don't expo to your original spot. Go for their probes, again, no money = no cannons or units.
I believe that the key concept when being cannon rush is realizing what is not happening. The usual response to such a situation is "OMG I'm dead", and seldomly do we think "Well, they can't move their cannons, they've invested a HUGE amount of money on this attack, and right now they have nothing but probes back home". Not trying to say that it is easy, but the key with such a situation is not falling into desperation.
Hope this was useful.
Regards.