The free energy of spherical pure $p$-spin models -- computation from the TAP approach