Perturbation theories for the calculation of molecular interaction energies. I. General formalism