Recently I needed to run a Python based application on Windows 7 x64 with Python 2.7.3 64-bit already installed. Unfortunately, the target application did not start, instead the following error was displayed:
Error loading Python DLL: python27.dll (error code 193)
One might now think that python27.dll simply could not be found by the target application.
But the error code says differently. Error code 126 would say a required DLL could not be found. Instead, error code 193 tells you that the architecture of the DLL found and the one required by the application do not match, i.e. 32-bit vs. 64-bit architecture mismatch. For reference the full error message states:
Error 193: Could not open Dll "python27.dll" or Python could not be properly initialized.
Since I was running Windows 7 64-bit I figured that I could give Python 32-bit a shot to test if the application was in fact relying on this particular DLL version, thus was based on the 32-bit architecture. At this point be sure to also remove any other Python versions installed, especially check your PATH for other installations that might get into your way.
A safety restart later the error message had gone – success! Happy Pythoning 🙂