That can be a difficult chore. I've done it a couple of different ways. One is to put the bolts in the holes in the cap but don't thread them into the block. Then on the center cap, you can take a rubber or plastic hammer and tap the bolts towards the center of the block, alternating from one bolt to the next. Usually the cap will work itself loose after a few taps. You can do the same thing on the rear cap, except tape the bolts front to back to get the cap loosened up.
Another way is to pry up on the the rear flange of the crank. Get a piece of 2X4 that goes almost all the way to the rear flange, and stick a pry bar between it and the flange, and then pry the flange up. The rear main cap will usually give when you do this.
There might be a more elegant way to do this that I don't know about; maybe someone else will chime in.