The invention discloses a mechanical arm hand-eye calibration method based on the spatial distance and epipolar line constraint. The mechanical arm hand-eye calibration method comprises the steps thatan initial value of a hand-eye conversion matrix is solved, a conversion relationship of a camera fixed to a mechanical arm when the mechanical arm is at the two different positions is obtained, epipolar line errors of feature points in images are calculated through internal parameters of the camera, the feature points are subjected to three-dimensional reconstruction, the spatial distance between the reconstructed feature points is calculated, spatial distance errors are calculated according to the actual spatial distance, the cumulative sum of all the epipolar line errors and the spatial distance errors of all the feature points serve as an optimized objective function, iterative optimization is conducted through a Levenberg-Marquardt algorithm, and the hand-eye conversion matrix with higher precision is obtained. According to the mechanical arm hand-eye calibration method, the optimized objective function which better meets the actual demands can be constructed, thus the spatial size calculated by the hand-eye conversion matrix is more consistent to the actual size, the convergence rate of iterative optimization is increased, it is ensured that the optimized parameters meet theepipolar geometry constraint, and the precision is higher.