<p>I am trying to calculate the number of paralogs for a few genes in different species in Ensembl. I am wondering if there is any tool which can do it automatically. Thank you.</p>

As from your question it looks you like to use Python for this, you could also opt to use the <a href="http://beta.rest.ensembl.org">Ensembl REST API</a>.

It's easy to get all orthologues for a gene, for example for the human ABCD1 gene:

http://beta.rest.ensembl.org/homology/symbol/human/ABCD1?content-type=application/json;format=condensed;type=orthologues

or all paralogues for the same gene:

http://beta.rest.ensembl.org/homology/symbol/human/ABCD1?content-type=application/json;format=condensed;type=paralogues

So, using these REST statements, I think it should be quite easy for you to start out with a particular gene in e.g. human, find the orthologues in the other Ensembl species and then get the number of paralogues for those genes.

How you can use REST statements in Python code you can find in the REST <a href="http://beta.rest.ensembl.org/documentation/info/homology_symbol">documentation</a> for the statement in question.

Hope this helps.