The coherent spin dynamics of electrons and holes in CsPbI3 perovskite nanocrystals in a glass matrix are studied by the time-resolved Faraday ellipticity technique in magnetic fields up to 430 mT across a temperature range from 6 K to 120 K. The Landé g-factors and spin dephasing times are evaluated from the observed Larmor precession of electron and hole spins. The nanocrystal size in the three studied samples varies from about 8 to 16 nm, resulting in exciton transition varying from 1.69 to 1.78 eV at a temperature of 6 K, allowing us to study the corresponding energy dependence of the g-factors. The electron g-factor decreases with increasing confinement energy in the NCs as a result of NC size reduction, and also with increasing temperature. The hole g-factor shows the opposite trend. Model analysis shows that the variation of g-factors with NC size arises from the transition energy dependence of the g-factors, which becomes strongly renormalized by temperature.