Due to prediction on the traffic flow is influenced by the real environment and historical data, the produced traffic graph may include significant uncertainty. The graph convolution operation is widely used in traffic flow prediction with its effective modeling ability on graph structures. However, in this method, it ignores the roles of external factors and historical data from fixed period is used that inevitably will lead to exclusion of detailed dynamic spatial–temporal correlation. To this end, we propose a novel method based on prior knowledge enhanced time-varying graph convolution network (PKET-GCN). First, we characterize factors affecting the traffic flow into dynamic and static features. The dynamic features include data correlation and external interference, while the static features consist of physical distances. Then we design a prior knowledge based module to extract the correlation of nodes and combine it with graph convolution to obtain dynamic spatial features. Next, a time-varying feature extraction module is designed to derive dynamic and long-term temporal features from periodic and adjacent sequences. Finally, the projection module is established to fuse the multiple modules and give the prediction value. The experimental results on five real-world datasets indicate that PKET-GCN is more effective than several existing methods.