Aiming at the problems that the Flower Pollination (FP) algorithm is easy to fall into the local optimum, the searchability is weak, and the k-means algorithm is easily affected by the selection of the initial clustering centre, a k-means algorithm based on the FP algorithm is proposed. Six benchmark functions test the improved FP algorithm. The effectiveness of the k-means algorithm based on the improved FP algorithm was tested and verified with UCI machine learning and artificial datasets. The verification results showed that the improved FP algorithm improved based on ensuring a faster convergence speed. Compared with other algorithms, the performance of this algorithm has been significantly improved in all aspects.