In this paper we show how to apply Grobner bases to compute the Drazin inverse of a matrix with multivariate rational functions as entries. When the coefficients of the rational functions depend on parameters, we give sufficient conditions for the Drazin inverse to specialize properly. In addition, we extend the method to weighted Drazin inverses. We present an empirical analysis that shows a good timing performance of the method. (C) 2015 Elsevier Inc. All rights reserved.