It is shown that a small system in thermodynamic equilibrium with a finite thermostat can have a q-exponential probability distribution which closely depends on the energy nonextensivity and the particle number of the thermostat. The distribution function will reduce to the exponential one at the thermodynamic limit. However, the nonextensivity of the system should not be neglected.