I think you're on the right track. You could still try following the example of the scipy.linalg documentation, in particular the Solving least-squares...` section
A = np.column_stack((np.ones(x.size), x, y))
c, resid,rank,sigma = np.linalg.lstsq(A,zi)
(we added a column of 1 for the constant).