Most African nationals need a visa. Exceptions: Seychelles and Mauritius (visa-free).
All other African countries (Algeria to Zimbabwe) require a Mexican visa. Requirements can change—verify with the Mexican Secretariat of Foreign Affairs or nearest consulate before travel.