This paper studies the inverse kinematics of two non-spherical wrist configurations of painting robot. The simplest analytical solution of orthogonal wrist configuration is deduced in this paper for the first time. For the oblique wrist configuration, there is no analytical solution for the configuration. So it is necessary to solve by general method, which cannot achieve high precision and high speed as analytic solution. Two general methods are optimized in this paper. Firstly, the elimination method is optimized to reduce the solving speed to 20% of the original one, and the completeness of the method is supplemented. Based on the Gauss damped least squares method, a new optimization method is proposed to improve the solving speed. The enhanced step length coefficient is introduced to conduct studies with the machine learning correlation method. It has been proved that, on the basis of ensuring the stability of motion, the number of iterations can be effectively reduced and the average number of iterations can be less than 5 times, which can effectively improve the speed of solution. In the simulation and experimental environment, it is verified.