Photovoltaic power generation has attracted more and more attention in the field of new energy applications, and the maximum power point tracking technology is the critical link of the photovoltaic power generation system. In the case of partial shading, the output power curve of the photovoltaic array presents a multi-peak phenomenon, and the traditional MPPT algorithm is easy to fall into the optimal local solution when tracking the maximum power, while the traditional butterfly algorithm has slow convergence and low optimization accuracy in the tracking process. In order to reduce the loss of output power of photovoltaic system, an MPPT control method combining butterfly algorithm with adaptive inertia weight and variable step size disturbance observation method is proposed. In the butterfly algorithm, the population randomly generates the initial solution, and the crossover mutation operation is carried out on the population. The inertia weight is constantly updated with the increase of iteration times, which can reduce the oscillation amplitude in the tracking process, increase the robustness of the algorithm search, and achieve the purpose of global search. Then, the perturbation observation method with variable step size is used to accelerate the convergence speed and accuracy. The simulation results show that compared with the traditional perturbation observation method and butterfly optimization algorithm, the proposed algorithm can find the maximum power point stably, quickly, and accurately in the case of sudden illumination change, which significantly improves the performance of MPPT.