You will need to do a hardware comparison and performance analysis in order to troubleshoot the problem.
If the server has faster processors/memory/motherboard, then yes, just about any program will run faster. Is sufficient memory available? If the code does a lot of I/O then disk performance could be an issue. If the code does any network calls, you will need to look at that to see how fast those calls take.
Are both machines running the same version of Python? What other software, such as anti-virus, is installed on these machines? Are other running programs using cpu/memory/disk?
You will need to isolate the problem before anyone on this forum can really help you.