Background: M2 macrophages perform an influential role in the progression of pancreatic cancer. This study is dedicated to explore the value of M2 macrophage-related genes in the treatment and prognosis of pancreatic cancer.Methods: RNA-Seq and clinical information were downloaded from TCGA, GEO and ICGC databases. The pancreatic cancer tumour microenvironment was revealed using the CIBERSORT algorithm. Weighted gene co-expression network analysis (WGCNA) was used to detect M2 macrophage-associated gene modules. Univariate Cox regression, Least absolute shrinkage and selection operator (LASSO) regression analysis and multivariate Cox regression were applied to develop the prognostic model. The modelling and validation cohorts were divided into high-risk and low-risk groups according to the median risk score. The nomogram predicting survival was constructed based on risk scores. Correlations between risk scores and tumour mutational load, clinical variables, immune checkpoint blockade, and immune cells were further explored. Finally, potential associations between different risk models and chemotherapeutic agent efficacy were predicted.Results: The intersection of the WGCNA results from the TCGA and GEO data screened for 317 M2 macrophage-associated genes. Nine genes were identified by multivariate COX regression analysis and applied to the construction of risk models. The results of GSEA analysis revealed that most of these genes were related to signaling, cytokine receptor interaction and immunodeficiency pathways. The high and low risk groups were closely associated with tumour mutational burden, immune checkpoint blockade related genes, and immune cells. The maximum inhibitory concentrations of metformin, paclitaxel, and rufatinib lapatinib were significantly differences on the two risk groups.Conclusion: WGCNA-based analysis of M2 macrophage-associated genes can help predict the prognosis of pancreatic cancer patients and may provide new options for immunotherapy of pancreatic cancer.