The African wildcat lives in a wide range of habitats except rainforest, but throughout the savannahs of Africa from Mauritania on the Atlantic coast eastwards to the Horn of Africa up to altitudes of 3000 meters .