Humidity is an important environmental parameter, which is difficult to be measured accurately and quickly using traditional measurement methods. Under the environment of low temperature or high humidity, traditional humidity and temperature sensor has shortages in humidity measurement accuracy, corresponding time and wet fade speed. To solve these problems, this paper proposes a method to measure the environmental humidity with wavelength modulation technology and harmonic detection technology based on tunable diode laser absorption spectroscopy. H2O molecular absorption line near 1392 nm is selected as the characteristic spectra. The effects of temperature, pressure and water concentration on the absorption spectrum width, the wavelength modulation coefficient and the amplitude of the harmonic signal are analyzed. Humidity and temperature sensor is modified using temperature and pressure compensation model, and the influence of the water concentration variation is eliminated by the iterative algorithm. The new humidity and temperature sensor prototype is developed, and the structure of the optical system is simple, which is easy to be adjusted. The response frequency of the humidity detection is 40 Hz. The experiment was carried out for 3 months at Qingdao national basic weather station. Experimental results show that the consistency of the humidity and temperature data is very good, which can proves the validity of the humidity measurement technology.