Accurate long-term streamflow and flood forecasting have always been an important research direction in hydrology research. Nowadays, climate change, floods, and other anomalies occurring more and more frequently and bringing great losses to society. The prediction of streamflow, especially flood prediction, is important for disaster prevention. Current hydrological models based on physical mechanisms can give accurate predictions of streamflow, but the effective prediction period is only about 1 month in advance, which is too short for decision making. The artificial neural network (ANN) has great potential for predicting runoff and is not only good at handling non-linear data but can also make long-period forecasts. However, most of ANN models are unstable in their predictions when faced with raw flow data, and have excessive errors in predicting extreme flows. Previous studies have shown a link between the El Niño–Southern Oscillation (ENSO) and the streamflow of the Yangtze River. In this paper, we use ENSO and the monthly streamflow data of the Yangtze River from 1952 to 2018 to predict the monthly streamflow of the Yangtze River in two extreme flood years and a small flood year by using deep neural networks. In this paper, three deep neural network frameworks are used: stacked long short-term memory, Conv long short-term memory encoder–decoder long short-term memory and Conv long short-term memory encoder–decoder gate recurrent unit. The results show that the use of ConvLSTM improves the stability of the model and increases the accuracy of the flood prediction. Besides, the introduction of ENSO to the experimental data resulted in a more accurate prediction of the time of the occurrence of flood peaks and flood flows. Furthermore, the best results were obtained on the convolutional long short-term memory + encoder–decoder gate recurrent unit model.