Drug-drug interaction (DDI) is the combined effects of multiple drugs taken together, which can either enhance or reduce each other’s efficacy. Thus, drug interaction analysis plays an important role in improving treatment effectiveness and patient safety. It has become a new challenge to use computational methods to accelerate drug interaction time and reduce its cost-effectiveness. The existing methods often do not fully explore the relationship between the structural information and the functional information of drug molecules, resulting in low prediction accuracy for drug interactions, poor generalization, and other issues. In this paper, we propose a novel method, which is a deep graph contrastive learning model for drug-drug interaction prediction (DeepGCL for brevity). DeepGCL incorporates a contrastive learning component to enhance the consistency of information between different views (molecular structure and interaction network), which means that the DeepGCL model predicts drug interactions by integrating molecular structure features and interaction network topology features. Experimental results show that DeepGCL achieves better performance than other methods in all datasets. Moreover, we conducted many experiments to analyze the necessity of each component of the model and the robustness of the model, which also showed promising results. The source code of DeepGCL is freely available at https://github.com/jzysj/DeepGCL.