In view of the problem that array errors lead to the performance degradation of the high-resolution direction of arrival (DOA) algorithms, we proposed an offline array errors correction method based on the invasive weed optimization (IWO) and particle swarm optimization (PSO) algorithm for sensor position errors. By using an auxiliary signal source with known azimuth, and combining the basic principle of subspace and the IWO-PSO algorithm, we transform the array errors solution into the parameter optimization problem, and modify the original steering vector with the estimated array errors. After correction of sensor position errors of linear arrays, good DOA estimation performances are obtained. In addition, the proposed method has no special requirements on array structure, and can be extended to the sensor position errors calibration of other arbitrary arrays.