The interaction between pyridine pillar[5]arene (PyP5) and 2-naphthol with the former as the host molecule and the latter as the guest molecule is studied by fluorescence spectroscopy and NMR techniques, and the results show that PyP5 forms a 1:1 host-guest inclusion complex with 2-naphthol. Although free 2-naphthol has strong fluorescence, it is quenched in 2-naphthol@PyP5. Experiments were conducted with 2-naphthol@PyP5 as a fluorescent probe to detect different anions with results showing that only CO32− causes a significant enhancement of the fluorescence of the fluorescent probe. Due to this high selectivity and high sensitivity, the fluorescent probe 2-naphthol@PyP5 may open up an effective way for the detection of CO32−.