In order to solve the problem that the traffic flow prediction model only focuses on the time dimension, which results in the model's low accuracy. In this paper, the three most influential weather features are extracted from the weather data through the principal component analysis (PCA). Weather features are extracted by PCA algorithm. The combined input of weather and time characteristics is compared with the input of time characteristics to obtain the simulation results. Experimental simulation results show that the RMSE and MAPE of the model decreased to 11.9844% and 7.1398 respectively when the extracted weather characteristics were used as the input of LSTM. The construction of the model can optimize the travel experience and facilitate the traffic department to grasp the traffic flow.