With the improving the intelligence level of traditional power systems, power cyber physical system also faces increasingly serious network security issues. For the detection of false data injection attacks (FDIA), A detection method based on artificial fish swarm-K-means (AFS-K-means) clustering is introduced. This method utilizes artificial fish swarm algorithm to generate initial cluster centers for the K-means clustering, thereby resolving the heavy reliance of the traditional K-means clustering algorithm on initial cluster centers and improving the accuracy of FDIA detection. A simulation is conducted based on the IEEE-30 bus system, and the result indicates that the proposed AFS-K-means clustering algorithm can effectively detect FDIAs, and exhibits superior performance comparing to other similar methods.